当前位置: 首页>>代码示例>>PHP>>正文


PHP Assert::isNumeric方法代码示例

本文整理汇总了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;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:12,代码来源:DBQueryException.class.php

示例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;
 }
开发者ID:phoebius,项目名称:proof-of-concept,代码行数:13,代码来源:SysVCachePeer.class.php

示例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;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:30,代码来源:RussianTextUtils.class.php

示例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;
}
开发者ID:Bobsel,项目名称:gn-tic,代码行数:36,代码来源:db.user.php

示例5: setPort

 /**
  * @param integer $port
  * @return HttpUrl itself
  */
 function setPort($port)
 {
     Assert::isNumeric($port);
     $this->port = $port;
     return $this;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:10,代码来源:HttpUrl.class.php

示例6: test_should_support_numeric_assertion

 public function test_should_support_numeric_assertion()
 {
     $this->assertTrue(Assert::isNumeric(3));
 }
开发者ID:yvoyer,项目名称:assertion,代码行数:4,代码来源:AssertTest.php

示例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;
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:17,代码来源:Exceptionizer.class.php

示例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  ");
}
开发者ID:Bobsel,项目名称:gn-tic,代码行数:7,代码来源:db.scans.php


注:本文中的Assert::isNumeric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。