當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。