/** * Creates a instance from a status string,. * * @param string $status the status string, case insensitive. * @param array $messages the message from the server * * @return InstantArticleStatus */ public static function fromStatus($status, $messages) { $status = strtolower($status); $validStatus = Type::isWithin($status, [self::SUCCESS, self::NOT_FOUND, self::IN_PROGRESS, self::FAILED]); if ($validStatus) { return new self($status, $messages); } else { \Logger::getLogger('facebook-instantarticles-client')->info("Unknown status '{$status}'. Are you using the last SDK version?"); return new self(self::UNKNOWN, $messages); } }
/** * Creates a message from a level string, using INFO if a invalid level string is provided. * * @param string $level the level string, case insensitive. * @param string $message the message from the server * * @return ServerMessage the message with the proper level */ public static function fromLevel($level, $message) { $level = strtolower($level); $validLevel = Type::isWithin($level, [self::FATAL, self::ERROR, self::WARNING, self::INFO]); if ($validLevel) { return new self($level, $message); } else { \Logger::getLogger('facebook-instantarticles-client')->info('Unknown message level "$level". Are you using the last SDK version?'); return new self(self::INFO, $message); } }
public function testIsWithinFalseObj() { $image = Image::create(); $video = Video::create(); $anotherImg = Image::create(); $result = Type::isWithin($image, [$anotherImg, $video, 'z']); $this->assertFalse($result); }