本文整理汇总了PHP中Webmozart\Assert\Assert::integerish方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::integerish方法的具体用法?PHP Assert::integerish怎么用?PHP Assert::integerish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::integerish方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* 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: __construct
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: create
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);
}