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


PHP Assertion::string方法代码示例

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


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

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

示例2: setName

 /**
  * @param string $name
  */
 protected function setName($name)
 {
     Assertion::string($name);
     Assertion::notBlank($name);
     $this->attributes['name'] = $name;
     $this->name = $name;
 }
开发者ID:comphppuebla,项目名称:easy-forms,代码行数:10,代码来源:Element.php

示例3: withName

 /**
  * @param string $workflowName
  * @param string $workflowId
  * @return CreateWorkflow
  */
 public static function withName($workflowName, $workflowId)
 {
     Assertion::string($workflowName);
     Assertion::notEmpty($workflowName);
     Assertion::uuid($workflowId);
     return new self(__CLASS__, ['workflow_id' => $workflowId, 'name' => $workflowName]);
 }
开发者ID:prooph,项目名称:link-process-manager,代码行数:12,代码来源:CreateWorkflow.php

示例4: __construct

 /**
  * @param MappingInterface[] $mappings
  */
 public function __construct(array $mappings, string $className, callable $apply = null, callable $unapply = null)
 {
     foreach ($mappings as $mappingKey => $mapping) {
         Assertion::string($mappingKey);
         Assertion::isInstanceOf($mapping, MappingInterface::class);
         $this->mappings[$mappingKey] = $mapping->withPrefixAndRelativeKey($this->key, $mappingKey);
     }
     Assertion::classExists($className);
     if (null === $apply) {
         $apply = function (...$arguments) {
             return new $this->className(...array_values($arguments));
         };
     }
     if (null === $unapply) {
         $unapply = function ($value) {
             Assertion::isInstanceOf($value, $this->className);
             $values = [];
             $reflectionClass = new ReflectionClass($this->className);
             foreach ($reflectionClass->getProperties() as $property) {
                 /* @var $property ReflectionProperty */
                 $property->setAccessible(true);
                 $values[$property->getName()] = $property->getValue($value);
             }
             return $values;
         };
     }
     $this->className = $className;
     $this->apply = $apply;
     $this->unapply = $unapply;
 }
开发者ID:dasprid,项目名称:formidable,代码行数:33,代码来源:ObjectMapping.php

示例5: setFilename

 /**
  * @param string $filename
  */
 public function setFilename($filename)
 {
     Assertion::string($filename, 'Invalid filename.');
     Assertion::directory(dirname($filename), 'The selected directory does not exist.');
     Assertion::writeable(dirname($filename), 'The selected directory is not writable.');
     $this->filename = $filename;
 }
开发者ID:spomky-labs,项目名称:jose,代码行数:10,代码来源:Storable.php

示例6: __construct

 /**
  * @param string $text
  * @param callable $selectAction
  * @param bool $showItemExtra
  */
 public function __construct($text, callable $selectAction, $showItemExtra = false)
 {
     Assertion::string($text);
     $this->text = $text;
     $this->selectAction = $selectAction;
     $this->showItemExtra = (bool) $showItemExtra;
 }
开发者ID:mops1k,项目名称:cli-menu,代码行数:12,代码来源:SelectableItem.php

示例7: setToken

 /**
  * Устанавливает описание gitlab'a
  *
  * @param string $token
  *
  * @return $this
  * @throws \Assert\AssertionFailedException
  */
 public function setToken($token)
 {
     Assertion::notEmpty($token);
     Assertion::string($token);
     $this->token = $token;
     return $this;
 }
开发者ID:old-town-gitlab-tools,项目名称:core,代码行数:15,代码来源:OAuth.php

示例8: withData

 /**
  * @param string $aggregateType
  * @param string $aggregateId
  * @param int $version
  * @return TakeSnapshot
  */
 public static function withData($aggregateType, $aggregateId, $version)
 {
     Assertion::string($aggregateType);
     Assertion::string($aggregateId);
     Assertion::min($version, 1);
     return new self(['aggregate_type' => $aggregateType, 'aggregate_id' => $aggregateId, 'version' => $version]);
 }
开发者ID:bweston92,项目名称:snapshotter,代码行数:13,代码来源:TakeSnapshot.php

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

示例10: createExchangePipeline

 protected function createExchangePipeline(MigrationTargetInterface $migration_target, $exchange_name)
 {
     Assertion::string($exchange_name);
     $wait_exchange_name = $exchange_name . self::WAIT_SUFFIX;
     $wait_queue_name = $wait_exchange_name . self::QUEUE_SUFFIX;
     $unrouted_exchange_name = $exchange_name . self::UNROUTED_SUFFIX;
     $unrouted_queue_name = $unrouted_exchange_name . self::QUEUE_SUFFIX;
     $repub_exchange_name = $exchange_name . self::REPUB_SUFFIX;
     $repub_queue_name = $repub_exchange_name . self::QUEUE_SUFFIX;
     $channel = $this->getConnection($migration_target)->channel();
     // Setup the default exchange and queue pipelines
     $channel->exchange_declare($unrouted_exchange_name, 'fanout', false, true, false, true);
     //internal
     $channel->exchange_declare($repub_exchange_name, 'fanout', false, true, false, true);
     //internal
     $channel->exchange_declare($wait_exchange_name, 'fanout', false, true, false);
     $channel->exchange_declare($exchange_name, 'direct', false, true, false, false, false, ['alternate-exchange' => ['S', $unrouted_exchange_name]]);
     $channel->queue_declare($wait_queue_name, false, true, false, false, false, ['x-dead-letter-exchange' => ['S', $exchange_name]]);
     $channel->queue_bind($wait_queue_name, $wait_exchange_name);
     $channel->queue_declare($unrouted_queue_name, false, true, false, false, false, ['x-dead-letter-exchange' => ['S', $repub_exchange_name], 'x-message-ttl' => ['I', self::REPUB_INTERVAL]]);
     $channel->queue_bind($unrouted_queue_name, $unrouted_exchange_name);
     $channel->queue_declare($repub_queue_name, false, true, false, false);
     $channel->queue_bind($repub_queue_name, $repub_exchange_name);
     $this->createShovel($migration_target, $repub_exchange_name, $exchange_name, $repub_queue_name);
 }
开发者ID:honeybee,项目名称:honeybee,代码行数:25,代码来源:RabbitMqMigration.php

示例11: getProjectConfig

 /**
  * Returns a project config instance.
  *
  * @param string $project Project name
  *
  * @return Config
  */
 public function getProjectConfig($project)
 {
     Assertion::string($project);
     Assertion::notEmpty($project);
     $config = $this->configLoader->load(array($this->getConfigFilePath($project)));
     return $config;
 }
开发者ID:mykanoa,项目名称:kanoa,代码行数:14,代码来源:ConfigHandler.php

示例12: fromString

 /**
  * Initializes and returns a coordinate object with the specified coordinate information in string format.
  *
  * Valid format:
  * "latitude in degrees, longitude in degrees"
  *
  * Example:
  * "51.3703748, 6.1724031"
  *
  * Please note that UTM and MGRS coordinates are not yet supported!
  *
  * @param $coordinate Coordinate information in string format
  *
  * @return static
  */
 public static function fromString($coordinate)
 {
     Assertion::string($coordinate);
     Assertion::true(substr_count($coordinate, ',') === 1);
     $coordinate = explode(',', $coordinate);
     return new static((double) $coordinate[0], (double) $coordinate[1]);
 }
开发者ID:patrickkempff,项目名称:location,代码行数:22,代码来源:Coordinate2d.php

示例13: addOptions

 private function addOptions(DOMDocument $document, DOMNode $node, array $options, array $selectedValues)
 {
     foreach ($options as $value => $label) {
         if (is_int($value)) {
             $value = (string) $value;
         } else {
             Assertion::string($value);
         }
         Assertion::true(is_string($label) || is_array($label));
         if (is_array($label)) {
             $optgroup = $document->createElement('optgroup');
             $this->addAttributes($optgroup, ['label' => $value]);
             $this->addOptions($document, $optgroup, $label, $selectedValues);
             $node->appendChild($optgroup);
             continue;
         }
         $option = $document->createElement('option');
         $option->appendChild($document->createTextNode($label));
         $htmlAttributes = ['value' => $value];
         if (in_array($value, $selectedValues)) {
             $htmlAttributes['selected'] = 'selected';
         }
         $this->addAttributes($option, $htmlAttributes);
         $node->appendChild($option);
     }
 }
开发者ID:dasprid,项目名称:formidable,代码行数:26,代码来源:Select.php

示例14: __construct

 /**
  * @param string $type
  * @param string $code
  */
 public function __construct($type, $code)
 {
     Assertion::inArray($type, $this->types);
     Assertion::string($code);
     $this->type = $type;
     $this->code = $code;
 }
开发者ID:jacmoe,项目名称:php-workshop,代码行数:11,代码来源:CodeInsertion.php

示例15: normalize

 /**
  * @param string $messageName
  * @return string
  */
 public static function normalize($messageName)
 {
     Assertion::notEmpty($messageName);
     Assertion::string($messageName);
     $search = array(static::MESSAGE_NAME_PREFIX, "-", "\\", "/", " ");
     return strtolower(str_replace($search, "", $messageName));
 }
开发者ID:prooph,项目名称:processing,代码行数:11,代码来源:MessageNameUtils.php


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