本文整理汇总了PHP中Webmozart\Assert\Assert::range方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::range方法的具体用法?PHP Assert::range怎么用?PHP Assert::range使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::range方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param UniquenessCheckerInterface $uniquenessChecker
* @param int $tokenLength
*
* @throws \InvalidArgumentException
*/
public function __construct(UniquenessCheckerInterface $uniquenessChecker, $tokenLength)
{
Assert::integer($tokenLength, 'The value of token length has to be an integer.');
Assert::range($tokenLength, 1, 40, 'The value of token length has to be in range between 1 to 40.');
$this->tokenLength = $tokenLength;
$this->uniquenessChecker = $uniquenessChecker;
}
示例2: __construct
/**
* @param UniquenessCheckerInterface $uniquenessChecker
* @param int $pinLength
*
* @throws \InvalidArgumentException
*/
public function __construct(UniquenessCheckerInterface $uniquenessChecker, $pinLength)
{
Assert::integer($pinLength, 'The value of pin length has to be an integer.');
Assert::range($pinLength, 1, 9, 'The value of pin length has to be in range between 1 to 9.');
$this->pinLength = $pinLength;
$this->uniquenessChecker = $uniquenessChecker;
}