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


PHP Assert::nullOrNotEmpty方法代码示例

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


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

示例1: __construct

 /**
  * Creates a new configuration file.
  *
  * @param string|null $path       The path where the configuration file is stored
  *                                or `null` if this configuration is not stored
  *                                on the file system.
  * @param Config      $baseConfig The configuration that the configuration will
  *                                inherit its values from.
  *
  * @throws InvalidArgumentException If the path is not a string or empty.
  */
 public function __construct($path = null, Config $baseConfig = null)
 {
     Assert::nullOrString($path, 'The path to the configuration file should be a string or null. Got: %s');
     Assert::nullOrNotEmpty($path, 'The path to the configuration file should not be empty.');
     // Inherit from default configuration
     $this->config = new Config($baseConfig);
     $this->path = $path;
 }
开发者ID:kormik,项目名称:manager,代码行数:19,代码来源:ConfigFile.php

示例2: __construct

 /**
  * Creates a binding type descriptor.
  *
  * @param string                       $name        The name of the type.
  * @param string|null                  $description A human-readable
  *                                                  description of the type.
  * @param BindingParameterDescriptor[] $parameters  The parameters.
  *
  * @see BindingType
  */
 public function __construct($name, $description = null, array $parameters = array())
 {
     Assert::typeName($name);
     Assert::nullOrString($description, 'The description must be a string or null. Got: %s');
     Assert::nullOrNotEmpty($description, 'The description must not be empty.');
     Assert::allIsInstanceOf($parameters, __NAMESPACE__ . '\\BindingParameterDescriptor');
     $this->name = $name;
     $this->description = $description;
     foreach ($parameters as $parameter) {
         $this->parameters[$parameter->getName()] = $parameter;
     }
 }
开发者ID:niklongstone,项目名称:manager,代码行数:22,代码来源:BindingTypeDescriptor.php

示例3: __construct

 /**
  * Creates the parameter.
  *
  * @param string      $name         The parameter name.
  * @param int         $flags        A bitwise combination of the flag
  *                                  constants in this class.
  * @param null        $defaultValue The default value of the parameter. Must
  *                                  only be set for optional parameters.
  * @param string|null $description  A human-readable description.
  */
 public function __construct($name, $flags = self::OPTIONAL, $defaultValue = null, $description = null)
 {
     Assert::parameterName($name);
     Assert::nullOrInteger($flags, 'The parameter "$flags" must be an integer or null. Got: %s');
     Assert::nullOrParameterValue($defaultValue);
     Assert::nullOrString($description, 'The parameter description must be a string or null. Got: %s');
     Assert::nullOrNotEmpty($description, 'The parameter description must not be empty.');
     if ($flags & self::REQUIRED && null !== $defaultValue) {
         throw new RuntimeException('Required parameters cannot have default values.');
     }
     $this->name = $name;
     $this->flags = (int) $flags;
     $this->defaultValue = $defaultValue;
     $this->description = $description;
 }
开发者ID:puli,项目名称:asset-plugin,代码行数:25,代码来源:InstallerParameter.php


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