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


PHP Assertion::lessOrEqualThan方法代码示例

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


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

示例1: checkClaim

 /**
  * {@inheritdoc}
  */
 public function checkClaim(JWTInterface $jwt)
 {
     if (!$jwt->hasClaim('iat')) {
         return [];
     }
     $iat = (int) $jwt->getClaim('iat');
     Assertion::lessOrEqualThan($iat, time(), 'The JWT is issued in the future.');
     return ['iat'];
 }
开发者ID:spomky-labs,项目名称:jose,代码行数:12,代码来源:IssuedAtChecker.php

示例2: checkClaim

 /**
  * {@inheritdoc}
  */
 public function checkClaim(JWTInterface $jwt)
 {
     if (!$jwt->hasClaim('nbf')) {
         return [];
     }
     $nbf = (int) $jwt->getClaim('nbf');
     Assertion::lessOrEqualThan($nbf, time(), 'The JWT can not be used yet.');
     return ['nbf'];
 }
开发者ID:spomky-labs,项目名称:jose,代码行数:12,代码来源:NotBeforeChecker.php

示例3: __construct

 private function __construct(Coords $startPoint, Coords $endPoint, $hits = 0)
 {
     Assertion::integer($hits);
     Assertion::greaterOrEqualThan($hits, 0);
     $size = $startPoint->distance($endPoint) + 1;
     Assertion::greaterOrEqualThan($size, static::MINIMUM_SIZE);
     Assertion::lessOrEqualThan($hits, $size);
     $this->startPoint = $startPoint;
     $this->endPoint = $endPoint;
     $this->hits = $hits;
 }
开发者ID:WeCamp,项目名称:flyingliquourice,代码行数:11,代码来源:Ship.php

示例4: __construct

 /**
  * A value object that contains a geographical coordinate.
  *
  * @param $latitude
  * @param $longitude
  */
 public function __construct($latitude, $longitude)
 {
     Assertion::true(is_int($latitude) || is_float($latitude));
     Assertion::true(is_int($longitude) || is_float($longitude));
     Assertion::greaterOrEqualThan($latitude, -90.0);
     Assertion::lessOrEqualThan($latitude, 90.0);
     Assertion::greaterOrEqualThan($longitude, -180.0);
     Assertion::lessOrEqualThan($longitude, 180.0);
     $this->latitude = $latitude;
     $this->longitude = $longitude;
 }
开发者ID:patrickkempff,项目名称:location,代码行数:17,代码来源:Coordinate2d.php

示例5: testLessOrEqualThanThrowsException

 /**
  * @dataProvider invalidLessOrEqualProvider
  */
 public function testLessOrEqualThanThrowsException($value, $limit)
 {
     $this->setExpectedException('Assert\\AssertionFailedException', null, Assertion::INVALID_LESS_OR_EQUAL);
     Assertion::lessOrEqualThan($value, $limit);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:8,代码来源:AssertTest.php

示例6: __construct

 /**
  * @param array[] $urls
  *
  * @throws \InvalidArgumentException
  */
 public function __construct(array $urls)
 {
     Assertion::allIsInstanceOf($urls, UrlInterface::class);
     Assertion::lessOrEqualThan(count($urls), UrlSetInterface::URL_MAX_COUNT);
     $this->urls = $urls;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:11,代码来源:UrlSet.php

示例7: performRequest

 /**
  * Performs a request to the symfony application and returns the response.
  *
  * @param string   $method
  * @param string   $uri
  * @param mixed[]  $parameters
  * @param bool     $expectSuccess
  * @param string[] $headers
  * @param mixed[]  $files
  * @param int      $expectedStatus
  * @param bool     $toJson
  * @param string   $apiKey
  * @param bool     $disableAssertions
  *
  * @throws \Exception If the json decode did not work
  *
  * @return string[]
  */
 protected function performRequest($method, $uri, array $parameters = [], $expectSuccess = true, array $headers = [], array $files = [], $expectedStatus = 200, $toJson = true, $apiKey = null, $disableAssertions = false)
 {
     if (null !== $apiKey || null !== AppContext::$apiKey) {
         $headers[ApiKeyAuthenticator::API_KEY_HEADER] = $apiKey ?: AppContext::$apiKey;
     }
     $headers = array_combine(array_map(function ($headerName) {
         return sprintf('HTTP_%s', $headerName);
     }, array_keys($headers)), array_values($headers));
     /** @var \Symfony\Bundle\FrameworkBundle\Client $client */
     $client = $this->getContainer()->get('test.client');
     $client->enableProfiler();
     $client->request($method, $uri, $parameters, $files, $headers);
     $response = $client->getResponse();
     if (!$disableAssertions) {
         $status = $response->getStatusCode();
         if ($expectSuccess) {
             Assertion::greaterOrEqualThan($status, 200);
             Assertion::lessOrEqualThan($status, 399);
         } else {
             Assertion::greaterOrEqualThan($status, 400);
             Assertion::lessOrEqualThan($status, 599);
         }
         Assertion::same($expectedStatus, $status);
     }
     $this->recentClient = $client;
     if ($toJson) {
         $content = $response->getContent();
         if (empty($content)) {
             $raw = null;
         } else {
             $raw = json_decode($content, true);
             Assertion::same(JSON_ERROR_NONE, json_last_error());
         }
         return $raw;
     }
     return $response;
 }
开发者ID:thomasmodeneis,项目名称:Sententiaregum,代码行数:55,代码来源:BaseContext.php

示例8: withTags

 /**
  * @param TagInterface[] $tags
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withTags(array $tags)
 {
     Assertion::allIsInstanceOf($tags, TagInterface::class);
     Assertion::lessOrEqualThan(count($tags), VideoInterface::TAG_MAX_COUNT);
     $instance = clone $this;
     $instance->tags = $tags;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:Video.php

示例9: withImages

 /**
  * @param ImageInterface[] $images
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withImages(array $images)
 {
     Assertion::allIsInstanceOf($images, ImageInterface::class);
     Assertion::lessOrEqualThan(count($this->images), UrlInterface::IMAGE_MAX_COUNT);
     $instance = clone $this;
     $instance->images = $images;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:15,代码来源:Url.php

示例10: withStockTickers

 /**
  * @param array $stockTickers
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withStockTickers(array $stockTickers)
 {
     Assertion::allString($stockTickers);
     Assertion::allNotBlank($stockTickers);
     Assertion::lessOrEqualThan(count($stockTickers), NewsInterface::STOCK_TICKERS_MAX_COUNT);
     $instance = clone $this;
     $instance->stockTickers = $stockTickers;
     return $instance;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:16,代码来源:News.php


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