integerish() публичный статический Метод

public static integerish ( $value, $message = '' )
Пример #1
0
 /**
  * Create the tag
  *
  * @param string             $body               Tag body
  * @param DescriptionFactory $descriptionFactory The description factory
  * @param Context|null       $context            The Context is used to resolve Types and FQSENs, although optional
  *                                               it is highly recommended to pass it. If you omit it then it is assumed that
  *                                               the DocBlock is in the global namespace and has no `use` statements.
  *
  * @return SleepTime
  */
 public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
 {
     Assert::integerish($body, self::MSG);
     Assert::greaterThanEq($body, 0, self::MSG);
     Assert::notNull($descriptionFactory);
     return new static($descriptionFactory->create($body, $context));
 }
Пример #2
0
 public function __construct($startingLine, $lineCount = null, Description $description = null)
 {
     Assert::integerish($startingLine);
     Assert::nullOrIntegerish($lineCount);
     $this->startingLine = (int) $startingLine;
     $this->lineCount = $lineCount !== null ? (int) $lineCount : null;
     $this->description = $description;
 }
Пример #3
0
 public static function create($body)
 {
     Assert::string($body);
     $parts = explode('.', $body);
     if (!empty($parts[0])) {
         Assert::integerish($parts[0]);
         $major = (int) array_shift($parts);
     } else {
         $major = 0;
     }
     if (!empty($parts[0])) {
         Assert::integerish($parts[0]);
         $minor = (int) array_shift($parts);
     } else {
         $minor = 0;
     }
     if (!empty($parts[0])) {
         Assert::integerish($parts[0]);
         $patch = (int) array_shift($parts);
     } else {
         $patch = 0;
     }
     return new static($major, $minor, $patch);
 }