當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Assert::isInteger方法代碼示例

本文整理匯總了PHP中Assert::isInteger方法的典型用法代碼示例。如果您正苦於以下問題:PHP Assert::isInteger方法的具體用法?PHP Assert::isInteger怎麽用?PHP Assert::isInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Assert的用法示例。


在下文中一共展示了Assert::isInteger方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: importValue

 public function importValue($value)
 {
     if ($value instanceof UnifiedContainer) {
         if ($value->isLazy()) {
             return $this->import(array($this->name => $value->getList()));
         } elseif ($value->getParentObject()->getId() && ($list = $value->getList())) {
             return $this->import(array($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(array($this->name => $value));
         } catch (WrongArgumentException $e) {
             return $this->import(array($this->name => ArrayUtils::getIdsArray($value)));
         }
     }
     return parent::importValue($value);
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:25,代碼來源:PrimitiveIdentifierList.class.php

示例2: makeSelectQuery

 private function makeSelectQuery(SqlSelectiveFieldSet $fields, $source, IDalExpression $condition = null, SqlOrderChain $orderBy = null, $limit = 0, $offset = 0)
 {
     Assert::isInteger($limit);
     Assert::isInteger($offset);
     $dialect = $this->getDB()->getDialect();
     $query = array();
     $query[] = 'SELECT ' . $fields->toDialectString($dialect);
     if (is_scalar($source)) {
         $source = $dialect->quoteIdentifier($source);
     } else {
         Assert::isTrue(is_array($source));
         $tables = array();
         foreach ($source as $table) {
             $tables[] = $dialect->quoteIdentifier($table);
         }
         $source = join(", ", $tables);
     }
     $query[] = 'FROM ' . $source;
     if ($condition) {
         $query[] = 'WHERE ' . $condition->toDialectString($dialect);
     }
     if ($orderBy) {
         $query[] = $orderBy->toDialectString($dialect);
     }
     if ($limit) {
         $query[] = 'LIMIT ' . (int) $limit;
     }
     if ($offset) {
         $query[] = 'OFFSET ' . (int) $offset;
     }
     $query = join("\r\n", $query);
     return $query;
 }
開發者ID:phoebius,項目名稱:proof-of-concept,代碼行數:33,代碼來源:QueryWorkbench.class.php

示例3: checkNumber

 protected function checkNumber($number)
 {
     if ($this->scalar) {
         Assert::isScalar($number);
     } else {
         Assert::isInteger($number);
     }
 }
開發者ID:rero26,項目名稱:onphp-framework,代碼行數:8,代碼來源:IdentifiablePrimitive.class.php

示例4: setMax

 /**
  * @throws WrongArgumentException
  * @return Range
  **/
 public function setMax($max = null)
 {
     if ($max !== null) {
         Assert::isInteger($max);
     } else {
         return $this;
     }
     return parent::setMax($max);
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:13,代碼來源:Range.class.php

示例5: 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;
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:16,代碼來源:QueryCombination.class.php

示例6: offset

 /**
  * Returns timeZone offset in
  *
  * @param unknown $timeZone
  * @param unknown $when
  * @return void
  * @access public
  */
 static function offset($timeZone, $when = 'now')
 {
     try {
         $DateTimeZone = new DateTimeZone($timeZone);
         $DateTime = new DateTime($when, $DateTimeZone);
         $offset = (int) $DateTimeZone->getOffset($DateTime);
     } catch (Exception $Exception) {
         throw new AppException($Exception->getMessage());
     }
     Assert::isInteger($offset);
     return $offset;
 }
開發者ID:stripthis,項目名稱:donate,代碼行數:20,代碼來源:time_zone.php

示例7: 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:onphp-framework,項目名稱:onphp-framework,代碼行數:17,代碼來源:AMQP.class.php

示例8: importValue

 public function importValue($value)
 {
     if (is_array($value)) {
         try {
             Assert::isInteger(current($value));
             return $this->import(array($this->name => $value));
         } catch (WrongArgumentException $e) {
             return $this->import(array($this->name => ArrayUtils::getIdsArray($value)));
         }
     }
     return parent::importValue($value);
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:12,代碼來源:PrimitiveEnumList.class.php

示例9: __construct

 public function __construct(IpAddress $ip, $mask)
 {
     Assert::isInteger($mask);
     if ($mask == 0 || self::MASK_MAX_SIZE < $mask) {
         throw new WrongArgumentException('wrong mask given');
     }
     $this->longMask = (int) (pow(2, 32 - $mask) * (pow(2, $mask) - 1));
     if (($ip->getLongIp() & $this->longMask) != $ip->getLongIp()) {
         throw new WrongArgumentException('wrong ip network given');
     }
     $this->ip = $ip;
     $this->mask = $mask;
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:13,代碼來源:IpNetwork.class.php

示例10: checkNumber

 protected function checkNumber($number)
 {
     Assert::isInteger($number);
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:4,代碼來源:PrimitiveInteger.class.php

示例11: sendContentLength

 public static function sendContentLength($length)
 {
     Assert::isInteger($length);
     header("Content-Length: {$length}");
     self::$headerSent = true;
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:6,代碼來源:HeaderUtils.class.php

示例12: 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:onphp-framework,項目名稱:onphp-framework,代碼行數:21,代碼來源:AMQPSelective.class.php

示例13: setDataSetIndex

 public function setDataSetIndex($index)
 {
     Assert::isInteger($index);
     $this->dataSetIndex = $index;
     return $this;
 }
開發者ID:onphp-framework,項目名稱:onphp-framework,代碼行數:6,代碼來源:ChartLabelStyle.class.php

示例14: 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:onphp-framework,項目名稱:onphp-framework,代碼行數:14,代碼來源:Form.class.php

示例15: markCustom

 /**
  * Set's custom error mark for primitive.
  * 
  * @return Form
  **/
 public function markCustom($primitiveName, $customMark)
 {
     Assert::isInteger($customMark);
     $this->errors[$this->get($primitiveName)->getName()] = $customMark;
     return $this;
 }
開發者ID:rero26,項目名稱:onphp-framework,代碼行數:11,代碼來源:Form.class.php


注:本文中的Assert::isInteger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。