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


PHP Assert::greaterThan方法代码示例

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


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

示例1: release

 /**
  * {@inheritdoc}
  */
 public function release(StockableInterface $stockable, $quantity)
 {
     Assert::greaterThan($quantity, 0, 'Quantity of units must be greater than 0.');
     $this->dispatchEvent(SyliusStockableEvents::PRE_RELEASE, $stockable);
     $stockable->setOnHold($stockable->getOnHold() - $quantity);
     $this->dispatchEvent(SyliusStockableEvents::POST_RELEASE, $stockable);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:InventoryOperator.php

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

示例3: setName

 /**
  * Sets the name of the command.
  *
  * Contrary to the base implementation, the name of an option command must
  * contain at least two characters.
  *
  * @param string $name The name of the command.
  *
  * @return static The current instance.
  */
 public function setName($name)
 {
     if (null !== $name) {
         Assert::string($name, 'The command name must be a string or null. Got: %s');
         Assert::notEmpty($name, 'The command name must not be empty.');
         Assert::greaterThan(strlen($name), 1, sprintf('The command name should contain at least two characters. Got: "%s"', $name));
     }
     parent::setName($name);
     return $this;
 }
开发者ID:webmozart,项目名称:console,代码行数:20,代码来源:OptionCommandConfig.php

示例4: __construct

 /**
  * Creates a new binding.
  *
  * @param string                      $query      The resource query.
  * @param Resource|ResourceCollection $resources  The resources to bind.
  * @param BindingType                 $type       The type to bind against.
  * @param array                       $parameters Additional parameters.
  * @param string                      $language   The language of the resource query.
  *
  * @throws NoSuchParameterException  If an invalid parameter was passed.
  * @throws MissingParameterException If a required parameter was not passed.
  * @throws InvalidArgumentException  If the resources are invalid.
  */
 public function __construct($query, $resources, BindingType $type, array $parameters = array(), $language = 'glob')
 {
     if ($resources instanceof Resource) {
         $resources = new ArrayResourceCollection(array($resources));
     }
     if (!$resources instanceof ResourceCollection) {
         throw new InvalidArgumentException(sprintf('Expected resources of type ResourceInterface or ' . 'ResourceCollectionInterface. Got: %s', is_object($resources) ? get_class($resources) : gettype($resources)));
     }
     Assert::greaterThan(count($resources), 0, 'You should pass at least one resource to EagerBinding.');
     parent::__construct($query, $type, $parameters, $language);
     $this->resources = $resources;
 }
开发者ID:kormik,项目名称:discovery,代码行数:25,代码来源:EagerBinding.php

示例5: assertLongNameValid

 private function assertLongNameValid($longName)
 {
     Assert::string($longName, 'The long option name must be a string. Got: %s');
     Assert::notEmpty($longName, 'The long option name must not be empty.');
     Assert::greaterThan(strlen($longName), 1, sprintf('The long option name must contain more than one character. Got: "%s"', $longName));
     Assert::startsWithLetter($longName, 'The long option name must start with a letter.');
     Assert::regex($longName, '~^[a-zA-Z0-9\\-]+$~', 'The long option name must contain letters, digits and hyphens only.');
 }
开发者ID:webmozart,项目名称:console,代码行数:8,代码来源:AbstractOption.php


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