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


PHP Assert::checkInteger方法代码示例

本文整理汇总了PHP中Hesper\Core\Base\Assert::checkInteger方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::checkInteger方法的具体用法?PHP Assert::checkInteger怎么用?PHP Assert::checkInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hesper\Core\Base\Assert的用法示例。


在下文中一共展示了Assert::checkInteger方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: import

 public function import($scope)
 {
     if (!$this->className) {
         throw new WrongStateException("no class defined for PrimitiveIdentifierList '{$this->name}'");
     }
     if (!BasePrimitive::import($scope)) {
         return null;
     }
     if (!is_array($scope[$this->name])) {
         return false;
     }
     $list = array_unique($scope[$this->name]);
     $values = [];
     foreach ($list as $id) {
         if (!Assert::checkInteger($id)) {
             return false;
         }
         $values[] = $id;
     }
     $objectList = [];
     foreach ($values as $value) {
         $className = $this->className;
         $objectList[] = new $className($value);
     }
     if (count($objectList) == count($values)) {
         $this->value = $objectList;
         return true;
     }
     return false;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:30,代码来源:PrimitiveEnumList.php

示例2: quoteValue

 public function quoteValue($value)
 {
     /// @see Sequenceless for this convention
     if ($value instanceof Identifier && !$value->isFinalized()) {
         return 'null';
     }
     if (Assert::checkInteger($value)) {
         return $value;
     }
     return "'" . sqlite_escape_string($value) . "'";
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:LiteDialect.php

示例3: quoteValue

 public function quoteValue($value)
 {
     /// @see Sequenceless for this convention
     if ($value instanceof Identifier && !$value->isFinalized()) {
         return 'null';
     }
     if (Assert::checkInteger($value)) {
         return $value;
     }
     return $this->getLink()->quote($value);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:LitePDODialect.php

示例4: __construct

 public function __construct($input)
 {
     if (Assert::checkInteger($input)) {
         $time = $input;
     } else {
         Assert::isString($input);
         $time = explode(':', $input);
     }
     $lenght = strlen($input);
     if (count($time) === 2) {
         $this->setHour($time[0])->setMinute($time[1]);
     } elseif (count($time) === 3) {
         $this->setHour($time[0])->setMinute($time[1])->setSecond($time[2]);
     } else {
         switch ($lenght) {
             case 1:
             case 2:
                 $this->setHour(substr($input, 0, 2));
                 break;
             case 3:
                 $assumedHour = substr($input, 0, 2);
                 if ($assumedHour > 23) {
                     $this->setHour(substr($input, 0, 1))->setMinute(substr($input, 1, 2));
                 } else {
                     $this->setHour($assumedHour)->setMinute(substr($input, 2, 1) . '0');
                 }
                 break;
             case 4:
             case 5:
             case 6:
                 $this->setHour(substr($input, 0, 2))->setMinute(substr($input, 2, 2))->setSecond(substr($input, 4, 2));
                 break;
             default:
                 throw new WrongArgumentException('unknown format');
         }
     }
 }
开发者ID:justthefish,项目名称:hesper,代码行数:37,代码来源:Time.php

示例5: __toString

 public function __toString()
 {
     return '[error at line ' . (Assert::checkInteger($this->errorLine) ? $this->errorLine : 'unknown') . ', position ' . (Assert::checkInteger($this->errorPosition) ? $this->errorPosition : 'unknown') . ": {$this->message}] in: \n" . $this->getTraceAsString();
 }
开发者ID:justthefish,项目名称:hesper,代码行数:4,代码来源:SyntaxErrorException.php

示例6: import

 public function import($scope)
 {
     if (!$this->className) {
         throw new WrongStateException("no class defined for PrimitiveIdentifierList '{$this->name}'");
     }
     if (!BasePrimitive::import($scope)) {
         return null;
     }
     if (!is_array($scope[$this->name])) {
         return false;
     }
     $list = array_unique($scope[$this->name]);
     $values = [];
     foreach ($list as $id) {
         if ((string) $id == "" && $this->isIgnoreEmpty()) {
             continue;
         }
         if ($this->scalar && !Assert::checkScalar($id) || !$this->scalar && !Assert::checkInteger($id)) {
             if (!$this->isIgnoreWrong()) {
                 return false;
             } else {
                 continue;
             }
             //just skip it
         }
         $values[] = $id;
     }
     $objectList = $this->dao()->getListByIds($values);
     if ((count($objectList) == count($values) || $this->isIgnoreWrong()) && !($this->min && count($values) < $this->min) && !($this->max && count($values) > $this->max)) {
         $this->value = $objectList;
         return true;
     }
     return false;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:34,代码来源:PrimitiveIdentifierList.php

示例7: castNumber

 protected function castNumber($number)
 {
     if (!$this->scalar && Assert::checkInteger($number)) {
         return (int) $number;
     }
     return $number;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:7,代码来源:IdentifiablePrimitive.php

示例8: setBatchSize

 public function setBatchSize($size)
 {
     if (Assert::checkInteger($size) && $size > 0) {
         $this->batchSize = $size;
     }
     return $this;
 }
开发者ID:avid,项目名称:hesper,代码行数:7,代码来源:Cursor.php


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