本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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.');
}