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


PHP Assertion::regex方法代码示例

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


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

示例1: __construct

 /**
  * @param string $value
  */
 private function __construct($value)
 {
     if (!empty($value)) {
         Guard::regex($value, '/^[a-z]{2}(_[A-Z]{2})?$/', "Locale is invalid: " . $value);
     }
     $this->value = $value;
 }
开发者ID:gingerpayments,项目名称:ginger-php,代码行数:10,代码来源:Locale.php

示例2: setPath

 private function setPath($path)
 {
     Assertion::string($path);
     Assertion::regex($path, '|(?mi-Us)^(/[a-zA-Z][a-zA-Z0-9_-]*)+(/@[a-zA-Z][a-zA-Z0-9_-]*)?$|');
     $this->path = $path;
     return $this;
 }
开发者ID:metasyntactical,项目名称:xml-tools,代码行数:7,代码来源:XmlPath.php

示例3: __construct

 private function __construct($repositoryName)
 {
     Ensure::string($repositoryName);
     Ensure::notBlank($repositoryName);
     Ensure::regex($repositoryName, '/^[a-zA-Z0-9\\-]+\\/[a-zA-Z0-9\\-\\.]+$/');
     $this->repositoryName = $repositoryName;
 }
开发者ID:jeroenvdgulik,项目名称:lonelypullrequests.com,代码行数:7,代码来源:RepositoryName.php

示例4: checkStartParameters

 /**
  * Checking input parameters for working with API BPM
  * @param $collection
  * @param $format
  */
 public function checkStartParameters($collection, $format)
 {
     $collection = ucfirst($collection);
     $format = mb_strtolower($format);
     \Assert\that($collection, 'The first parameter expects a string to the type of collection has BPM')->string();
     Assertion::regex($format, '~^json$|^xml$~', 'Expects parameter json or xml');
 }
开发者ID:agoalofalife,项目名称:bpm-online,代码行数:12,代码来源:ApiBpm.php

示例5: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::regex($this->projection_type, '#^([a-z][a-z_-]+(?<!_-)\\.){2}[a-z][a-z_]+(?<!_)::projection\\.[a-z][a-z_]+(?<!_)$#');
     Assertion::isArray($this->data);
     Assertion::regex($this->projection_identifier, '/[\\w\\.\\-_]{1,128}\\-\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}\\-\\w{2}_\\w{2}\\-\\d+/');
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:7,代码来源:ProjectionEvent.php

示例6: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::regex($this->aggregate_root_type, '#^([a-z][a-z_-]+(?<![_-])\\.){2}[a-z][a-z_-]+(?<![_-])$#');
     Assertion::integer($this->seq_number);
     Assertion::isInstanceOf($this->embedded_entity_events, EmbeddedEntityEventList::CLASS);
     Assertion::regex($this->aggregate_root_identifier, '/[\\w\\.\\-_]{1,128}\\-\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}\\-\\w{2}_\\w{2}\\-\\d+/');
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:8,代码来源:AggregateRootEvent.php

示例7: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::keyExists($this->data, 'parent_node_id');
     Assertion::string($this->data['parent_node_id']);
     if ($this->data['parent_node_id'] !== '') {
         Assertion::regex($this->data['parent_node_id'], '/[\\w\\.\\-_]{1,128}\\-\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}\\-\\w{2}_\\w{2}\\-\\d+/');
     }
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:9,代码来源:AggregateRootNodeMovedEvent.php

示例8: __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

示例9: evaluate

 public function evaluate($expected, $message)
 {
     switch ($this->strategy) {
         case 0:
             $message = sprintf($message, $this->value, $expected);
             Assertion::same($this->value, $expected, $message);
             break;
         case 1:
             $message = sprintf('Expected `%s` to match regex `%s`, but it didn\'t`', $expected, $this->value);
             Assertion::regex($expected, $this->value, $message);
             break;
         case 2:
             $message = sprintf($message, $this->value, gettype($expected));
             Assertion::same($this->value, gettype($expected), $message);
             break;
     }
 }
开发者ID:alexbilbie,项目名称:fizzfuzz,代码行数:17,代码来源:Expectation.php

示例10: check

 /**
  * {@inheritdoc}
  */
 public function check(ClientInterface $client, array $registration_parameters)
 {
     if (!$this->hasScopeManager()) {
         return;
     }
     if (array_key_exists('scope', $registration_parameters)) {
         Assertion::regex($registration_parameters['scope'], '/^[\\x20\\x23-\\x5B\\x5D-\\x7E]+$/', 'Invalid characters found in the "scope" parameter.');
         $client->set('scope', $registration_parameters['scope']);
     }
     if (array_key_exists('scope_policy', $registration_parameters)) {
         Assertion::inArray($registration_parameters['scope_policy'], $this->getScopeManager()->getSupportedScopePolicies(), sprintf('The scope policy "%s" is not supported. Please choose one of the following policy: "%s".', $registration_parameters['scope_policy'], json_encode($this->getScopeManager()->getSupportedScopePolicies())));
         $client->set('scope_policy', $registration_parameters['scope_policy']);
     }
     /*
      * Should be handled by the scope policy itself
      */
     if (array_key_exists('default_scope', $registration_parameters)) {
         Assertion::regex($registration_parameters['default_scope'], '/^[\\x20\\x23-\\x5B\\x5D-\\x7E]+$/', 'Invalid characters found in the "default_scope" parameter.');
         $client->set('default_scope', $registration_parameters['default_scope']);
     }
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:24,代码来源:ScopeRule.php

示例11: validateInput

 private function validateInput(string $input)
 {
     Assertion::regex($input, '/^[\\(\\)]+$/', 'Input must only consist of \'(\' or \')\'');
 }
开发者ID:stefanotorresi,项目名称:thorr-advent,代码行数:4,代码来源:Day1.php

示例12: __construct

 public function __construct($value)
 {
     //Filenames must be md5 followed by jpg, gif, bmp, png
     Assertion::regex($value, '/^[a-f0-9]{32}\\.(jpg|png|gif|bmp)^/i');
     $this->value = $value;
 }
开发者ID:bakgat,项目名称:notos,代码行数:6,代码来源:Filename.php

示例13: guardRequiredState

 protected function guardRequiredState()
 {
     parent::guardRequiredState();
     Assertion::integer($this->known_revision);
     Assertion::regex($this->aggregate_root_identifier, '/[\\w\\.\\-_]{1,128}\\-\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}\\-\\w{2}_\\w{2}\\-\\d+/');
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:6,代码来源:AggregateRootCommand.php

示例14: __construct

 public function __construct($value)
 {
     Assertion::regex($value, '/^.{4,}$/', 'Password must be at least 4 characters');
     $this->value = $value;
 }
开发者ID:xtreamwayz,项目名称:zend-expressive-app-poc,代码行数:5,代码来源:Password.php

示例15: __construct

 public function __construct($value)
 {
     Assertion::regex($value, '/^[a-z]{3,16}$/', 'Username accepts only lowercase letters');
     $this->value = (string) $value;
 }
开发者ID:xtreamwayz,项目名称:zend-expressive-app-poc,代码行数:5,代码来源:Username.php


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