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


PHP Assert::string方法代码示例

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


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

示例1: addParticipation

 /**
  * Adds a participation to the data collector.
  *
  * @param string $testIdentifier It will look like "Qp0gahJ3RAO3DJ18b0XoUQ"
  * @param int $variationIndex
  * @throws InvalidArgumentException
  */
 public function addParticipation($testIdentifier, $variationIndex)
 {
     Assert::string($testIdentifier, 'Test identifier must be a string');
     Assert::integer($variationIndex, 'Variation index must be integer');
     Assert::greaterThan($variationIndex, -1, 'Variation index must be integer >= 0');
     $this->participations[$testIdentifier] = $variationIndex;
 }
开发者ID:phpab,项目名称:phpab,代码行数:14,代码来源:Google.php

示例2: create

 /**
  * {@inheritdoc}
  */
 public static function create($body, FqsenResolver $resolver = null, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
 {
     Assert::string($body);
     Assert::allNotNull([$resolver, $descriptionFactory]);
     $parts = preg_split('/\\s+/Su', $body, 2);
     return new static($resolver->resolve($parts[0], $context), $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context));
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:10,代码来源:Uses.php

示例3: convertNameToCode

 /**
  * {@inheritdoc}
  */
 public function convertNameToCode($name, $locale = 'en')
 {
     $names = Intl::getLocaleBundle()->getLocaleNames($locale);
     $code = array_search($name, $names, true);
     Assert::string($code, sprintf('Cannot find code for "%s" locale name', $name));
     return $code;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:LocaleConverter.php

示例4: create

 public static function create($body)
 {
     Assert::string($body);
     $scope = preg_split('/(,?\\s+)/Su', $body);
     $scope = array_filter($scope);
     return new static($scope);
 }
开发者ID:stratedge,项目名称:inspection,代码行数:7,代码来源:ApiScope.php

示例5: create

 /**
  * Creates a new tag that represents any unknown tag type.
  *
  * @param string             $body
  * @param string             $name
  * @param DescriptionFactory $descriptionFactory
  * @param Context            $context
  *
  * @return static
  */
 public static function create($body, $name = '', DescriptionFactory $descriptionFactory = null, Context $context = null)
 {
     Assert::string($body);
     Assert::stringNotEmpty($name);
     $description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null;
     return new static($name, $description);
 }
开发者ID:Ocramius,项目名称:ReflectionDocBlock,代码行数:17,代码来源:Generic.php

示例6: __construct

 /**
  * @param string      $variableName
  * @param Type        $type
  * @param Description $description
  */
 public function __construct($variableName, Type $type = null, Description $description = null)
 {
     Assert::string($variableName);
     $this->variableName = $variableName;
     $this->type = $type;
     $this->description = $description;
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:12,代码来源:PropertyRead.php

示例7: create

 /**
  * {@inheritdoc}
  */
 public static function create($body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null)
 {
     Assert::string($body);
     Assert::notNull($descriptionFactory);
     $parts = preg_split('/\\s+/Su', $body, 2);
     $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null;
     return new static($parts[0], $description);
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:11,代码来源:Link.php

示例8: doDelete

 private function doDelete($name)
 {
     Assert::string($name, "Name must be a string. Got: %s");
     foreach ((yield \Amp\File\scandir($this->root . "/" . $name)) as $file) {
         (yield \Amp\File\unlink($this->root . "/" . $name . "/" . $file));
     }
     (yield \Amp\File\rmdir($this->root . "/" . $name));
 }
开发者ID:kelunik,项目名称:acme-client,代码行数:8,代码来源:CertificateStore.php

示例9: doDelete

 private function doDelete($token)
 {
     Assert::string($token, "Token must be a string. Got: %s");
     $path = $this->docroot . "/.well-known/acme-challenge/{$token}";
     $realpath = realpath($path);
     if ($realpath) {
         (yield \Amp\File\unlink($realpath));
     }
 }
开发者ID:kelunik,项目名称:acme-client,代码行数:9,代码来源:ChallengeStore.php

示例10: create

 public static function create($body)
 {
     Assert::string($body);
     $parts = preg_split('/(\\n+)/Su', $body, 2);
     if (!empty($parts[0])) {
         $group = array_shift($parts);
     }
     return new static($group);
 }
开发者ID:stratedge,项目名称:inspection,代码行数:9,代码来源:ApiGroup.php

示例11: __construct

 /**
  * @param string $variableName
  * @param Type $type
  * @param bool $isVariadic
  * @param Description $description
  */
 public function __construct($variableName, Type $type = null, $isVariadic = false, Description $description = null)
 {
     Assert::string($variableName);
     Assert::boolean($isVariadic);
     $this->variableName = $variableName;
     $this->type = $type;
     $this->isVariadic = $isVariadic;
     $this->description = $description;
 }
开发者ID:levanigongadze,项目名称:Labweb,代码行数:15,代码来源:Param.php

示例12: __construct

 /**
  * Create a Serializer instance.
  *
  * @param int $indent The number of times the indent string is repeated.
  * @param string   $indentString    The string to indent the comment with.
  * @param bool     $indentFirstLine Whether to indent the first line.
  * @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
  */
 public function __construct($indent = 0, $indentString = ' ', $indentFirstLine = true, $lineLength = null)
 {
     Assert::integer($indent);
     Assert::string($indentString);
     Assert::boolean($indentFirstLine);
     Assert::nullOrInteger($lineLength);
     $this->indent = $indent;
     $this->indentString = $indentString;
     $this->isFirstLineIndented = $indentFirstLine;
     $this->lineLength = $lineLength;
 }
开发者ID:Ocramius,项目名称:ReflectionDocBlock,代码行数:19,代码来源:Serializer.php

示例13: __construct

 /**
  * Creates a new package DTO.
  *
  * @param string $name          The package name.
  * @param string $installerName The name of the installer.
  * @param string $installPath   The absolute install path.
  * @param string $state         One of the STATE_* constants in this class.
  */
 public function __construct($name, $installerName, $installPath, $state)
 {
     Assert::stringNotEmpty($name, 'The package name must be a non-empty string. Got: %s');
     Assert::string($installerName, 'The installer name must be a string. Got: %s');
     Assert::stringNotEmpty($installPath, 'The install path must be a non-empty string. Got: %s');
     Assert::oneOf($state, self::$states, 'The package state must be one of %2$s. Got: %s');
     $this->name = $name;
     $this->installerName = $installerName;
     $this->installPath = $installPath;
     $this->state = $state;
 }
开发者ID:WedgeSama,项目名称:composer-plugin,代码行数:19,代码来源:PuliPackage.php

示例14: create

 public static function create($body, Context $context = null)
 {
     Assert::string($body);
     $parts = preg_split('/(\\s+)/Su', $body, 1);
     if (!empty($parts[0])) {
         $key = array_shift($parts);
     } else {
         $key = null;
     }
     return new static($key);
 }
开发者ID:stratedge,项目名称:inspection,代码行数:11,代码来源:ApiInclude.php

示例15: create

 /**
  * Attempts to create a new Author object based on †he tag body.
  *
  * @param string $body
  *
  * @return static
  */
 public static function create($body)
 {
     Assert::string($body);
     $splitTagContent = preg_match('/^([^\\<]*)(?:\\<([^\\>]*)\\>)?$/u', $body, $matches);
     if (!$splitTagContent) {
         return null;
     }
     $authorName = trim($matches[1]);
     $email = isset($matches[2]) ? trim($matches[2]) : '';
     return new static($authorName, $email);
 }
开发者ID:Ocramius,项目名称:ReflectionDocBlock,代码行数:18,代码来源:Author.php


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