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


PHP Assert::isInteger方法代码示例

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


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

示例1: importValue

 public function importValue($value)
 {
     if ($value instanceof UnifiedContainer) {
         if ($value->isLazy()) {
             return $this->import([$this->name => $value->getList()]);
         } elseif ($value->getParentObject()->getId() && ($list = $value->getList())) {
             return $this->import([$this->name => ArrayUtils::getIdsArray($list)]);
         } else {
             return parent::importValue(null);
         }
     }
     if (is_array($value)) {
         try {
             if ($this->scalar) {
                 Assert::isScalar(current($value));
             } else {
                 Assert::isInteger(current($value));
             }
             return $this->import([$this->name => $value]);
         } catch (WrongArgumentException $e) {
             return $this->import([$this->name => ArrayUtils::getIdsArray($value)]);
         }
     }
     return parent::importValue($value);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:25,代码来源:PrimitiveIdentifierList.php

示例2: setMax

 /**
  * @throws WrongArgumentException
  * @return Range
  **/
 public function setMax($max = null)
 {
     if ($max !== null) {
         Assert::isInteger($max);
     } else {
         return $this;
     }
     return parent::setMax($max);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:13,代码来源:Range.php

示例3: createChannel

 /**
  * @param integer $id
  * @throws WrongArgumentException
  * @return AMQPChannelInterface
  **/
 public function createChannel($id)
 {
     Assert::isInteger($id);
     if (isset($this->channels[$id])) {
         throw new WrongArgumentException("AMQP channel with id '{$id}' already registered");
     }
     if (!$this->isConnected()) {
         $this->connect();
     }
     $this->channels[$id] = $this->spawnChannel($id, $this)->open();
     return $this->channels[$id];
 }
开发者ID:justthefish,项目名称:hesper,代码行数:17,代码来源:AMQP.php

示例4: importValue

 public function importValue($value)
 {
     if (is_array($value)) {
         try {
             Assert::isInteger(current($value));
             return $this->import([$this->name => $value]);
         } catch (WrongArgumentException $e) {
             return $this->import([$this->name => ArrayUtils::getIdsArray($value)]);
         }
     }
     return parent::importValue($value);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:PrimitiveEnumList.php

示例5: limit

 /**
  * @throws WrongArgumentException
  * @return SelectQuery
  **/
 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;
 }
开发者ID:avid,项目名称:hesper,代码行数:16,代码来源:SelectQuery.php

示例6: createChannel

 /**
  * @param integer $id
  * @throws WrongArgumentException
  * @return AMQPChannelInterface
  **/
 public function createChannel($id)
 {
     Assert::isInteger($id);
     if (isset($this->channels[$id])) {
         throw new WrongArgumentException("AMQP channel with id '{$id}' already registered");
     }
     if (!$this->current) {
         $this->setCurrent($this->getAlive());
     }
     if (!$this->isConnected()) {
         $this->connect();
     }
     $this->channels[$id] = new self::$proxy($this->getCurrentItem()->spawnChannel($id, $this));
     $this->channels[$id]->open();
     return $this->channels[$id];
 }
开发者ID:justthefish,项目名称:hesper,代码行数:21,代码来源:AMQPSelective.php

示例7: sendContentLength

 public static function sendContentLength($length)
 {
     Assert::isInteger($length);
     header("Content-Length: {$length}");
     self::$headerSent = true;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:6,代码来源:HeaderUtils.php

示例8: checkNumber

 protected function checkNumber($number)
 {
     Assert::isInteger($number);
 }
开发者ID:justthefish,项目名称:hesper,代码行数:4,代码来源:PrimitiveInteger.php

示例9: markCustom

 /**
  * Set's custom error mark for primitive.
  * @return Form
  **/
 public function markCustom($primitiveName, $customMark, $label = null)
 {
     Assert::isInteger($customMark);
     $this->errors[$this->get($primitiveName)->getName()] = $customMark;
     if ($label !== null) {
         $this->addCustomLabel($primitiveName, $customMark, $label);
     }
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:13,代码来源:Form.php

示例10: setSize

 /**
  * @throws WrongArgumentException
  * @return MetaClassProperty
  **/
 public function setSize($size)
 {
     if ($this->type instanceof NumericType) {
         if (strpos($size, ',') !== false) {
             list($size, $precision) = explode(',', $size, 2);
             $this->type->setPrecision($precision);
         }
     }
     Assert::isInteger($size, 'only integers allowed in size parameter');
     if ($this->type->isMeasurable()) {
         $this->size = $size;
     } else {
         throw new WrongArgumentException("size not allowed for '" . $this->getName() . '::' . get_class($this->type) . "' type");
     }
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:20,代码来源:MetaClassProperty.php

示例11: setDefault

 /**
  * @throws WrongArgumentException
  * @return IntegerType
  **/
 public function setDefault($default)
 {
     Assert::isInteger($default, "strange default value given - '{$default}'");
     $this->default = $default;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:10,代码来源:IntegerType.php

示例12: setScale

 /**
  * @throws WrongArgumentException
  * @return DataType
  **/
 public function setScale($scale)
 {
     Assert::isInteger($scale);
     Assert::isTrue(($this->id & self::HAVE_SCALE) > 0);
     $this->scale = $scale;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:DataType.php

示例13: checkNumber

 protected function checkNumber($number)
 {
     if ($this->scalar) {
         Assert::isScalar($number);
     } else {
         Assert::isInteger($number);
     }
 }
开发者ID:justthefish,项目名称:hesper,代码行数:8,代码来源:IdentifiablePrimitive.php

示例14: setPriority

 /**
  * Message priority from 0 to 9.
  *
  * @return AMQPBaseMessage
  **/
 public function setPriority($int)
 {
     Assert::isInteger($int, __METHOD__);
     Assert::isTrue($int >= self::PRIORITY_MIN && $int <= self::PRIORITY_MAX, __METHOD__);
     $this->properties[self::PRIORITY] = $int;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:12,代码来源:AMQPBaseMessage.php

示例15: setMaxAge

 public function setMaxAge($expire)
 {
     Assert::isInteger($expire);
     $this->expire = $expire;
     return $this;
 }
开发者ID:justthefish,项目名称:hesper,代码行数:6,代码来源:Cookie.php


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