/**
  * Create a Serializer instance.
  *
  * @param int $indent The number of times the indent string is repeated.
  * @param string   $indentString    The string to indent the comment with.
  * @param bool     $indentFirstLine Whether to indent the first line.
  * @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
  */
 public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null)
 {
     Assert::integer($indent);
     Assert::string($indentString);
     Assert::boolean($indentFirstLine);
     Assert::nullOrInteger($lineLength);
     $this->indent = $indent;
     $this->indentString = $indentString;
     $this->isFirstLineIndented = $indentFirstLine;
     $this->lineLength = $lineLength;
 }
Example #2
0
 /**
  * Creates a new parameter.
  *
  * @param string $name         The parameter name.
  * @param int    $flags        A bitwise combination of the flag constants
  *                             in this class.
  * @param mixed  $defaultValue The parameter's default value.
  */
 public function __construct($name, $flags = self::OPTIONAL, $defaultValue = null)
 {
     Assert::stringNotEmpty($name, 'The parameter name must be a non-empty string. Got: %s');
     Assert::startsWithLetter($name, 'The parameter name must start with a letter. Got: %s');
     Assert::nullOrInteger($flags, 'The parameter "$flags" must be an integer or null. Got: %s');
     if ($flags & self::REQUIRED && null !== $defaultValue) {
         throw new RuntimeException('Required parameters must not have default values.');
     }
     $this->name = $name;
     $this->flags = $flags;
     $this->defaultValue = $defaultValue;
 }
Example #3
0
 /**
  * Set semester
  *
  * @param integer $semester
  * @return User
  */
 public function setSemester($semester)
 {
     Assert::nullOrInteger($semester);
     $this->semester = $semester;
     return $this;
 }