本文整理汇总了PHP中Assert\Assertion::integerish方法的典型用法代码示例。如果您正苦于以下问题:PHP Assertion::integerish方法的具体用法?PHP Assertion::integerish怎么用?PHP Assertion::integerish使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert\Assertion
的用法示例。
在下文中一共展示了Assertion::integerish方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $direction
* @param int $days
*/
public function __construct($direction, $days)
{
Assertion::integerish($days);
Assertion::choice($direction, [self::DIRECTION_PAST, self::DIRECTION_FUTURE]);
$this->direction = $direction;
$this->days = (int) $days;
}
示例2: __construct
public function __construct($value)
{
try {
Assertion::integerish($value);
$this->value = (int) $value;
} catch (AssertionInvalidArgumentException $exception) {
throw new InvalidArgumentException($value, array('integer'));
}
}
示例3: __construct
public function __construct($filters, $offset, $limit, $sortField, $sortOrder, $isPaginated)
{
Assertion::isArray($filters, "Invalid filters");
Assertion::integerish($limit, "Invalid limit");
Assertion::integerish($offset, "Invalid offset");
Assertion::nullOrString($sortField, "Invalid sort field");
Assertion::choice($sortOrder, [null, self::ORDER_ASC, self::ORDER_DESC], "Invalid sort order");
Assertion::boolean($isPaginated, "Invalid value for isPaginated");
if ($limit < 0) {
throw new \InvalidArgumentException("Invalid limit");
}
if ($offset < 0) {
throw new \InvalidArgumentException("Invalid offset");
}
$this->filters = $filters;
$this->offset = (int) $offset;
$this->limit = (int) $limit;
$this->sortField = $sortField;
$this->sortOrder = $sortOrder;
$this->isPaginated = (bool) $isPaginated;
}
示例4: __construct
/**
* @param int $days
*/
public function __construct($days)
{
Assertion::integerish($days);
$this->days = (int) $days;
}
示例5: testInvalidIntegerish
/**
* @dataProvider dataInvalidIntegerish
*/
public function testInvalidIntegerish($nonInteger)
{
$this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_INTEGERISH);
Assertion::integerish($nonInteger);
}
示例6:
function _validateAmountIsNumeric()
{
Assertion::integerish($this->amount);
}
示例7: __construct
/**
* @param int $minSales
*/
public function __construct($minSales)
{
Assertion::integerish($minSales);
$this->minSales = (int) $minSales;
}
示例8: read
/**
* @param int $chunkSize
* @return string
*/
public function read($chunkSize = self::DEFAULT_CHUNK_SIZE)
{
Assertion::integerish($chunkSize);
return fread($this->resource, $chunkSize);
}