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


PHP Assertion::maxLength方法代碼示例

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


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

示例1: __construct

 /**
  * @param $name
  */
 public function __construct($name)
 {
     Assertion::string($name, 'StreamName must be a string');
     Assertion::notEmpty($name, 'StreamName must not be empty');
     Assertion::maxLength($name, 200, 'StreamName should not be longer than 200 chars');
     $this->name = $name;
 }
開發者ID:prooph,項目名稱:event-store,代碼行數:10,代碼來源:StreamName.php

示例2: __construct

 /**
  * @param $text
  */
 public function __construct($text)
 {
     Assertion::string($text);
     Assertion::minLength($text, 1);
     Assertion::maxLength($text, 1000);
     $this->text = $text;
 }
開發者ID:vincecore,項目名稱:sharemonkey,代碼行數:10,代碼來源:Text.php

示例3: __construct

 /**
  * @param string $value
  */
 public function __construct($value)
 {
     Assertion::string($value);
     Assertion::minLength($value, 1);
     Assertion::maxLength($value, 50);
     $this->value = strtolower($value);
 }
開發者ID:vincecore,項目名稱:sharemonkey,代碼行數:10,代碼來源:Tag.php

示例4: __construct

 /**
  * __construct()
  *
  * @param string $name Project name
  */
 public function __construct($name)
 {
     Assertion::string($name);
     Assertion::maxLength($name, 20, 'Project key exceeds max allowed chars');
     Assertion::regex($name, '/^[a-z0-9\\-]*$/', 'Project key does not match expected format');
     $this->name = $name;
     $this->environments = new \SplObjectStorage();
     $this->servers = new \SplObjectStorage();
     $this->tasks = new \SplObjectStorage();
 }
開發者ID:mykanoa,項目名稱:kanoa,代碼行數:15,代碼來源:Project.php

示例5: testValidMaxLength

 public function testValidMaxLength()
 {
     Assertion::maxLength("foo", 10);
     Assertion::maxLength("foo", 3);
     Assertion::maxLength("", 0);
     Assertion::maxLength("址址", 2);
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:7,代碼來源:AssertTest.php

示例6: referenceCode

 /**
  * Validate reference code:
  * Length <= 20
  * @param string $referenceCode
  */
 public static function referenceCode($referenceCode)
 {
     Assert::maxLength($referenceCode, 20);
 }
開發者ID:steefdw,項目名稱:bol-sdk,代碼行數:9,代碼來源:OfferAssertion.php

示例7: withCategory

 /**
  * @param string $category
  *
  * @throws \InvalidArgumentException
  *
  * @return static
  */
 public function withCategory($category)
 {
     Assertion::string($category);
     Assertion::maxLength($category, VideoInterface::CATEGORY_MAX_LENGTH);
     $instance = clone $this;
     $instance->category = $category;
     return $instance;
 }
開發者ID:refinery29,項目名稱:sitemap,代碼行數:15,代碼來源:Video.php


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