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


PHP Assertion::range方法代碼示例

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


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

示例1: 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

示例2: 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

示例3: it_passes_values_and_constraints_to_exception

 /**
  * @test
  */
 public function it_passes_values_and_constraints_to_exception()
 {
     try {
         Assertion::range(0, 10, 20);
         $this->fail('Exception expected');
     } catch (AssertionFailedException $e) {
         $this->assertEquals(0, $e->getValue());
         $this->assertEquals(array('min' => 10, 'max' => 20), $e->getConstraints());
     }
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:13,代碼來源:AssertTest.php

示例4: __construct

 /**
  * Deflate constructor.
  *
  * @param int $compression_level
  */
 public function __construct($compression_level = -1)
 {
     Assertion::integer($compression_level, 'The compression level can be given as 0 for no compression up to 9 for maximum compression. If -1 given, the default compression level will be the default compression level of the zlib library.');
     Assertion::range($compression_level, -1, 9, 'The compression level can be given as 0 for no compression up to 9 for maximum compression. If -1 given, the default compression level will be the default compression level of the zlib library.');
     $this->compression_level = $compression_level;
 }
開發者ID:spomky-labs,項目名稱:jose,代碼行數:11,代碼來源:ZLib.php

示例5: inRange

 public function inRange($value, $min, $max)
 {
     parent::range($value, $min, $max);
 }
開發者ID:loobee,項目名稱:ddd,代碼行數:4,代碼來源:AssertionAdapter.php

示例6: setStatus

 /**
  * @param int $status
  */
 private function setStatus($status)
 {
     Assertion::integer($status);
     Assertion::range($status, 0, 2);
     $this->status = $status;
 }
開發者ID:bweston92,項目名稱:done,代碼行數:9,代碼來源:ChapterStatus.php

示例7: getDataPer30Minutes

 /**
  * @param integer $interval (1 or 2)
  *
  * @return History
  */
 public function getDataPer30Minutes($interval = 1)
 {
     Assert::range($interval, 1, 2);
     $response = $this->browser->get($this->createDataUrl(self::TYPE_HISTORICAL, array('h' => $interval)));
     return $this->processHistoricalResponse($response);
 }
開發者ID:wjzijderveld,項目名稱:youless-client,代碼行數:11,代碼來源:Client.php


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