本文整理汇总了PHP中Assert::isPositiveInteger方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isPositiveInteger方法的具体用法?PHP Assert::isPositiveInteger怎么用?PHP Assert::isPositiveInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::isPositiveInteger方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: evaluate
public function evaluate($values)
{
if ($this->isBindable()) {
Assert::isPositiveInteger($this->getValue(), 'wrong substitution number: $' . $this->getValue());
Assert::isIndexExists($values, $this->getValue(), 'parameter $' . $this->getValue() . ' is not binded');
$value = $values[$this->getValue()];
} else {
$value = $this->getValue();
}
if ($value instanceof Query) {
return $value;
} elseif ($value instanceof Identifiable) {
return $value->getId();
} elseif (is_array($value)) {
$list = array();
foreach ($value as $key => $parameter) {
if ($parameter instanceof OqlQueryParameter) {
$list[$key] = $parameter->evaluate($values);
} else {
$list[$key] = $parameter;
}
}
return $list;
}
return $value;
}
示例2: setSummaryWeight
public function setSummaryWeight($weight)
{
Assert::isPositiveInteger($weight);
$this->summaryWeight = $weight;
$this->sorted = false;
return $this;
}
示例3: getBytes
public function getBytes($numberOfBytes)
{
Assert::isPositiveInteger($numberOfBytes);
$bytes = null;
for ($i = 0; $i < $numberOfBytes; $i += 4) {
$bytes .= pack('L', mt_rand());
}
return substr($bytes, 0, $numberOfBytes);
}
示例4: limit
/**
* @throws WrongArgumentException
* @return QueryCombination
**/
public function limit($limit = null, $offset = null)
{
if ($limit !== null) {
Assert::isPositiveInteger($limit, 'invalid limit specified');
}
if ($offset !== null) {
Assert::isInteger($offset, 'invalid offset specified');
}
$this->limit = $limit;
$this->offset = $offset;
return $this;
}
示例5: encode
public static function encode($integer)
{
Assert::isPositiveInteger($integer, 'Out of range');
$magicInt = strlen(self::$chars);
$string = '';
do {
$i = $integer % $magicInt;
$string = self::$chars[$i] . $string;
$integer = ($integer - $i) / $magicInt;
} while ($integer > 0);
return $string;
}
示例6: setOffset
function setOffset($offset)
{
if ($offset) {
Assert::isPositiveInteger($offset);
}
$this->offset = $offset;
return $this;
}
示例7: __construct
function __construct($name, $label, $defaultInputCount = 1)
{
Assert::isPositiveInteger($defaultInputCount);
parent::__construct($name, $label);
$this->setDefaultValue(array_fill(0, $defaultInputCount, null));
}
示例8: getAverage
public static function getAverage(array $list, $size = null)
{
if (!$size) {
$size = count($list);
}
Assert::isPositiveInteger($size);
$tempSum = 0;
for ($i = 0; $i < $size; $i++) {
$tempSum += $list[$i];
}
return $tempSum / $size;
}
示例9: getBytes
public function getBytes($numberOfBytes)
{
Assert::isPositiveInteger($numberOfBytes);
return fread($this->handle, $numberOfBytes);
}
示例10: setTtl
/**
* Sets a cookie lifetime (in seconds)
* @param int $ttl
* @return Cookie
*/
function setTtl($ttl)
{
Assert::isPositiveInteger($ttl);
$this->ttl = $ttl;
return $this;
}
示例11: setLength
/**
* @return CropFilter
**/
public function setLength($length)
{
Assert::isPositiveInteger($length);
$this->length = $length;
return $this;
}
示例12: setMinSize
function setMinSize($bytes)
{
Assert::isPositiveInteger($bytes);
$this->minSize = $bytes;
return $this;
}
示例13: setSize
public function setSize($size)
{
Assert::isPositiveInteger($size);
$this->size = $size;
return $this;
}
示例14: setHeight
/**
* @return GoogleChartSize
**/
public function setHeight($height)
{
Assert::isPositiveInteger($height);
$this->height = $height;
return $this;
}