/**
  * Instantiates a new InstantArticleStatus object.
  *
  * @param string $status
  * @param ServerMessage[] $messages
  */
 public function __construct($status, $messages = [])
 {
     Type::enforceWithin($status, [self::SUCCESS, self::NOT_FOUND, self::IN_PROGRESS, self::FAILED, self::UNKNOWN]);
     Type::enforceArrayOf($messages, ServerMessage::getClassName());
     $this->status = $status;
     $this->messages = $messages;
 }
 /**
  * @param string $level
  * @param string $message
  */
 public function __construct($level, $message)
 {
     Type::enforceWithin($level, [self::FATAL, self::ERROR, self::WARNING, self::INFO]);
     Type::enforce($message, Type::STRING);
     $this->level = $level;
     $this->message = $message;
 }
示例#3
0
 /**
  * The Text position that will be used.
  *
  * @see Caption::POSITION_ABOVE
  * @see Caption::POSITION_BELOW
  * @see Caption::POSITION_CENTER
  *
  * @param string $position that will be used.
  * @return $this
  */
 public function withPosition($position)
 {
     Type::enforceWithin($position, [Caption::POSITION_ABOVE, Caption::POSITION_BELOW, Caption::POSITION_CENTER]);
     $this->position = $position;
     return $this;
 }
 public function testEnforceWithinExceptionString()
 {
     $this->setExpectedException('InvalidArgumentException');
     Type::enforceWithin('a', ['x', 'y', 'z']);
 }
示例#5
0
 /**
  * Overwrites the current type of time
  *
  * @param string $type The type of this Article time (MODIFIED or PUBLISHED)
  *
  * @see Time::MODIFIED
  * @see Time::PUBLISHED
  *
  * @return $this
  */
 public function withType($type)
 {
     Type::enforceWithin($type, [Time::MODIFIED, Time::PUBLISHED]);
     $this->type = $type;
     return $this;
 }
示例#6
0
 /**
  * Sets the aspect ration presentation for the video.
  *
  * @param string $presentation one of the constants ASPECT_FIT, ASPECT_FIT_ONLY, FULLSCREEN or NON_INTERACTIVE
  *
  * @see Video::ASPECT_FIT
  * @see Video::ASPECT_FIT_ONLY
  * @see Video::FULLSCREEN
  * @see Video::NON_INTERACTIVE
  *
  * @return $this
  */
 public function withPresentation($presentation)
 {
     Type::enforceWithin($presentation, [Video::ASPECT_FIT, Video::ASPECT_FIT_ONLY, Video::FULLSCREEN, Video::NON_INTERACTIVE]);
     $this->presentation = $presentation;
     return $this;
 }
 /**
  * Sets the margin setting of your interactive graphic.
  *
  * @param string $margin The margin setting of your interactive graphic.
  *
  * @see Interactive::NO_MARGIN
  * @see Interactive::COLUMN_WIDTH
  *
  * @return $this
  */
 public function withMargin($margin)
 {
     Type::enforceWithin($margin, [Interactive::NO_MARGIN, Interactive::COLUMN_WIDTH]);
     $this->margin = $margin;
     return $this;
 }