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


PHP Assertion::integer方法代码示例

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


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

示例1: __construct

 /**
  * @param int $x
  * @param int $y
  */
 public function __construct($x, $y)
 {
     Assertion::integer($x);
     Assertion::integer($y);
     $this->x = $x;
     $this->y = $y;
 }
开发者ID:WeCamp,项目名称:flyingliquourice,代码行数:11,代码来源:Coords.php

示例2: findById

 /**
  * @param int $id
  *
  * @throws SubjectNotFoundException
  *
  * @return JusticeRecord|false
  */
 public function findById($id)
 {
     Assertion::integer($id);
     $crawler = $this->client->request('GET', sprintf(self::URL_SUBJECTS, $id));
     $detailUrl = $this->extractDetailUrlFromCrawler($crawler);
     if (false === $detailUrl) {
         return false;
     }
     $people = [];
     $crawler = $this->client->request('GET', $detailUrl);
     $crawler->filter('.aunp-content .div-table')->each(function (Crawler $table) use(&$people) {
         $title = $table->filter('.vr-hlavicka')->text();
         try {
             if ('jednatel: ' === $title) {
                 $person = JusticeJednatelPersonParser::parseFromDomCrawler($table);
                 $people[$person->getName()] = $person;
             } elseif ('Společník: ' === $title) {
                 $person = JusticeSpolecnikPersonParser::parseFromDomCrawler($table);
                 $people[$person->getName()] = $person;
             }
         } catch (\Exception $e) {
         }
     });
     return new JusticeRecord($people);
 }
开发者ID:dfridrich,项目名称:ares,代码行数:32,代码来源:Justice.php

示例3: getKey

 /**
  * @param int $index
  *
  * @return \Jose\Object\JWKInterface
  */
 public function getKey($index)
 {
     Assertion::integer($index, 'The index must be a positive integer.');
     Assertion::greaterOrEqualThan($index, 0, 'The index must be a positive integer.');
     Assertion::true($this->hasKey($index), 'Undefined index.');
     return $this->getKeys()[$index];
 }
开发者ID:spomky-labs,项目名称:jose,代码行数:12,代码来源:BaseJWKSet.php

示例4: setRadius

 /**
  * Set the radius in meters.
  *
  * @param int $meters
  *
  * @return self
  */
 public function setRadius($meters)
 {
     Assertion::integer($meters);
     Assertion::range($meters, 1, 100000);
     $this->radius = $meters;
     return $this;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:14,代码来源:CanSupportRadius.php

示例5: __construct

 /**
  * Constructor
  *
  * @param AMQPQueue[] $queues
  * @param float $idleTimeout in seconds
  * @param int $waitTimeout in microseconds
  * @param callable $deliveryCallback,
  * @param callable|null $flushCallback,
  * @param callable|null $errorCallback
  * @throws Exception\InvalidArgumentException
  */
 public function __construct(array $queues, $idleTimeout, $waitTimeout, callable $deliveryCallback, callable $flushCallback = null, callable $errorCallback = null)
 {
     Assertion::float($idleTimeout);
     Assertion::integer($waitTimeout);
     if (function_exists('pcntl_signal_dispatch')) {
         $this->usePcntlSignalDispatch = true;
     }
     if (function_exists('pcntl_signal')) {
         pcntl_signal(SIGTERM, [$this, 'shutdown']);
         pcntl_signal(SIGINT, [$this, 'shutdown']);
         pcntl_signal(SIGHUP, [$this, 'shutdown']);
     }
     if (empty($queues)) {
         throw new Exception\InvalidArgumentException('No queues given');
     }
     $q = [];
     foreach ($queues as $queue) {
         if (!$queue instanceof AMQPQueue) {
             throw new Exception\InvalidArgumentException('Queue must be an instance of AMQPQueue, ' . is_object($queue) ? get_class($queue) : gettype($queue) . ' given');
         }
         if (null === $this->blockSize) {
             $this->blockSize = $queue->getChannel()->getPrefetchCount();
         }
         $q[] = $queue;
     }
     $this->idleTimeout = (double) $idleTimeout;
     $this->waitTimeout = (int) $waitTimeout;
     $this->queues = new InfiniteIterator(new ArrayIterator($q));
 }
开发者ID:bweston92,项目名称:HumusAmqp,代码行数:40,代码来源:MultiQueueConsumer.php

示例6: changeQuantity

 /**
  * {@inheritdoc}
  */
 public function changeQuantity($quantity)
 {
     Assertion::integer($quantity, 'Quantity must be an integer');
     $quantity = $this->quantity + $quantity;
     // Use this to make sure a proper integer check is done after addition
     $this->setQuantity($quantity);
 }
开发者ID:indigophp,项目名称:cart,代码行数:10,代码来源:Quantity.php

示例7: setPeriod

 /**
  * @param int $period
  *
  * @return self
  */
 private function setPeriod($period)
 {
     Assertion::integer($period, 'Period must be at least 1.');
     Assertion::greaterThan($period, 0, 'Period must be at least 1.');
     $this->setParameter('period', $period);
     return $this;
 }
开发者ID:spomky-labs,项目名称:otphp,代码行数:12,代码来源:TOTP.php

示例8: setLimit

 /**
  * Set the limit.
  *
  * @param int $limit
  *
  * @return self
  */
 public function setLimit($limit)
 {
     Assertion::integer($limit);
     Assertion::range($limit, 1, 50);
     $this->limit = $limit;
     return $this;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:14,代码来源:CanBeLimited.php

示例9: __construct

 /**
  * Initialise text item
  *
  * @param string $breakChar
  * @param int    $lines
  */
 public function __construct($breakChar = ' ', $lines = 1)
 {
     Assertion::string($breakChar);
     Assertion::integer($lines);
     $this->breakChar = $breakChar;
     $this->lines = $lines;
 }
开发者ID:thehereward,项目名称:cli-menu,代码行数:13,代码来源:LineBreakItem.php

示例10: add

 /**
  * @param AddStorage $addStorage
  */
 public function add(AddStorage $addStorage)
 {
     Assertion::integer($addStorage->storage);
     Assertion::integer($addStorage->quota);
     $storage = Storage::withUserDateUsageQuota(User::named($addStorage->name), new \DateTime(), Bytes::allocateUnits((int) $addStorage->storage), Quota::fromBytes(Bytes::allocateUnits((int) $addStorage->quota)));
     $this->storageRepository->add($storage);
 }
开发者ID:arnovr,项目名称:owncloud-statistics,代码行数:10,代码来源:AddStorageHandler.php

示例11: generate

 /**
  * @param int $width
  * @param int $height
  * @param array $shipSizes
  * @return Fields
  */
 public static function generate($width, $height, array $shipSizes)
 {
     Assertion::integer($width);
     Assertion::integer($height);
     Assertion::allInteger($shipSizes);
     $elements = [];
     for ($y = 0; $y < $height; $y++) {
         for ($x = 0; $x < $width; $x++) {
             $elements[] = Field::generate($x, $y);
         }
     }
     $fields = Fields::create($elements);
     foreach ($shipSizes as $shipSize) {
         $attempts = 0;
         while (true) {
             if ($attempts == static::MAX_ATTEMPTS) {
                 throw new CannotPlaceShipOnGridException();
             }
             $direction = mt_rand(0, 1) == 0 ? 'right' : 'below';
             $spot = Coords::create(mt_rand(0, $width - 1), mt_rand(0, $height - 1));
             $endPoint = static::validEndpoint($fields, $spot, $shipSize, $direction);
             if ($endPoint === null) {
                 $attempts++;
                 continue;
             }
             // If we end up here the ship can fit at the determined spot
             $fields->place(Ship::create($spot, $endPoint));
             break;
         }
     }
     return $fields;
 }
开发者ID:WeCamp,项目名称:flyingliquourice,代码行数:38,代码来源:FieldsGenerator.php

示例12: __construct

 /**
  * @param ClockInterface $clock
  * @param integer $wait Wait for n milliseconds
  * @param integer $timeout Timeout after n milliseconds
  */
 public function __construct(ClockInterface $clock, $wait, $timeout)
 {
     Assertion::integer($wait);
     Assertion::integer($timeout);
     $this->clock = $clock;
     $this->wait = static::millisecondsToMicroseconds($wait);
     $this->timeout = static::millisecondsToMicroseconds($timeout);
 }
开发者ID:matthiasnoback,项目名称:phpunit-asynchronicity,代码行数:13,代码来源:Timeout.php

示例13: toFileMakerValue

 public function toFileMakerValue($value)
 {
     if (null === $value) {
         return null;
     }
     Assertion::integer($value);
     return Decimal::fromInteger($value);
 }
开发者ID:soliantconsulting,项目名称:simplefm,代码行数:8,代码来源:IntegerType.php

示例14: __construct

 /**
  * ClientSecretBasic constructor.
  *
  * @param string $realm
  * @param int    $secret_lifetime
  */
 public function __construct($realm, $secret_lifetime = 0)
 {
     Assertion::string($realm);
     Assertion::integer($secret_lifetime);
     Assertion::greaterOrEqualThan($secret_lifetime, 0);
     $this->realm = $realm;
     $this->secret_lifetime = $secret_lifetime;
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:14,代码来源:ClientSecretBasic.php

示例15: __construct

 /**
  * ClientAssertionJwt constructor.
  *
  * @param \Jose\JWTLoaderInterface                    $jwt_loader
  * @param \OAuth2\Exception\ExceptionManagerInterface $exception_manager
  * @param int                                         $secret_lifetime
  */
 public function __construct(JWTLoaderInterface $jwt_loader, ExceptionManagerInterface $exception_manager, $secret_lifetime = 0)
 {
     $this->setJWTLoader($jwt_loader);
     $this->setExceptionManager($exception_manager);
     Assertion::integer($secret_lifetime);
     Assertion::greaterOrEqualThan($secret_lifetime, 0);
     $this->secret_lifetime = $secret_lifetime;
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:15,代码来源:ClientAssertionJwt.php


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