本文整理汇总了PHP中Assert::isNumeric方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isNumeric方法的具体用法?PHP Assert::isNumeric怎么用?PHP Assert::isNumeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assert
的用法示例。
在下文中一共展示了Assert::isNumeric方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param ISqlQuery $query
* @param string $errormsg
* @param integer $errorno
*/
function __construct(ISqlQuery $query, $errormsg, $errorno)
{
Assert::isScalar($errormsg);
Assert::isNumeric($errorno);
parent::__construct($errormsg, $errorno);
$this->query = $query;
}
示例2: set
/**
* @see CachePeer::set()
*
* @return SysVCachePeer
*/
function set($key, $value, $ttl = CacheTtl::HOUR)
{
Assert::isNumeric($ttl);
if ($this->isAlive()) {
shm_put_var($this->getSegmentPtr(), $this->key2int($key), array(self::FIELD_EXPIRES => time() + $ttl, self::FIELD_DATA => $value));
}
return $this;
}
示例3: getDeclension
/**
* Choose russion word declension based on numeric.
*
* Example for $expressions: array("ответ", "ответа", "ответов")
*
* @param int $number
* @param array $expressions
* @return string
*/
static function getDeclension($number, array $expressions)
{
Assert::isNumeric($number);
if (count($expressions) < 3) {
$expressions[2] = $expressions[1];
}
$count = $number % 100;
if ($count >= 5 && $count <= 20) {
$result = $expressions[2];
} else {
$count = $count % 10;
if ($count == 1) {
$result = $expressions[0];
} elseif ($count >= 2 && $count <= 4) {
$result = $expressions[1];
} else {
$result = $expressions[2];
}
}
return $result;
}
示例4: highscore_list
function highscore_list($filter, $pages, $page = 1, $rows = 50)
{
Assert::isId($page);
Assert::isId($rows);
if ($filter['hours'] || $filter['days']) {
if ($filter['hours']) {
Assert::isNumeric($filter['hours']);
$timeout = date("Y-m-d H:m:s", time() - (int) $filter['hours'] * 60 * 60);
} else {
Assert::isNumeric($filter['days']);
$timeout = date("Y-m-d H:m:s", time() - (int) $filter['days'] * 24 * 60 * 60);
}
$count = selectsql("\n select count(*) as count\n from user u\n left join activity a on (a.uid = u.uid)\n where a.stamp > '{$timeout}'\n group by u.uid\n ");
$count = count($count);
#Seitenamzahl berechnen
$pages = ceil($count / $rows);
#Seite checken
if ($pages < $page && $pages != 0) {
$page = $pages;
}
$result = selectsql("\n select u.*,ga.*,a.*,sum(ac.bonus) as activity_points\n from user u\n left join activity ac on (ac.uid = u.uid)\n left join galaxy ga on (ga.gala = u.gala)\n left join alliance a on(a.aid = ga.aid)\n where ac.stamp > '{$timeout}'\n group by u.uid\n order by activity_points desc, u.nick asc\n LIMIT " . $rows * ($page - 1) . ",{$rows}\n ");
} else {
$count = selectsqlLine("\n select count(*) as count\n from user u\n ");
#Seitenamzahl berechnen
$pages = ceil($count['count'] / $rows);
#Seite checken
if ($pages < $page && $pages != 0) {
$page = $pages;
}
$result = selectsql("\n select * from user u\n left join galaxy ga on (ga.gala = u.gala)\n left join alliance a on(a.aid = ga.aid)\n order by u.activity_points desc, u.nick asc\n LIMIT " . $rows * ($page - 1) . ",{$rows}\n ");
}
for ($i = 0; $i < count($result); $i++) {
$result[$i]['place'] = $rows * ($page - 1) + $i + 1;
}
return $result;
}
示例5: setPort
/**
* @param integer $port
* @return HttpUrl itself
*/
function setPort($port)
{
Assert::isNumeric($port);
$this->port = $port;
return $this;
}
示例6: test_should_support_numeric_assertion
public function test_should_support_numeric_assertion()
{
$this->assertTrue(Assert::isNumeric(3));
}
示例7: setCoverMask
/**
* Sets the mask to what errors should be translated to exceptions. E.g., if you specify
* E_WARNING | E_NOTICE as the cover mask, E_NOTICE and E_WARNING errors would be translated
* to exceptions, but E_ERROR is not.
* @param integer $coverMask integer mask to specify what errors should be translated to
* exceptions. E.g., if you specify E_WARNING | E_NOTICE as the cover mask, E_NOTICE
* and E_WARNING errors would be translated to exceptions, but E_ERROR is not.
* Default is E_ALL.
* @return Exceptionizer itself
*/
function setCoverMask($coverMask = E_ALL)
{
Assert::isNumeric($coverMask);
Assert::isTrue(!!($coverMask & E_ALL), 'not an error mask');
$this->mask = $coverMask;
return $this;
}
示例8: miliscan_fleet_get_bykoords
function miliscan_fleet_get_bykoords($gala, $pos, $num)
{
Assert::isId($gala);
Assert::isId($pos);
Assert::isNumeric($num);
return selectsqlline("\n select * from scans s\n left join scanmili_fleet mf using(sid)\n left join fleet f on (f.fid = mf.fid)\n where s.gala = {$gala} and s.pos = {$pos} and mf.num = {$num}\n ");
}