本文整理汇总了PHP中Webmozart\Assert\Assert::greaterThanEq方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::greaterThanEq方法的具体用法?PHP Assert::greaterThanEq怎么用?PHP Assert::greaterThanEq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Assert\Assert
的用法示例。
在下文中一共展示了Assert::greaterThanEq方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Create the tag
*
* @param string $body Tag body
* @param DescriptionFactory $descriptionFactory The description factory
* @param Context|null $context The Context is used to resolve Types and FQSENs, although optional
* it is highly recommended to pass it. If you omit it then it is assumed that
* the DocBlock is in the global namespace and has no `use` statements.
*
* @return SleepTime
*/
public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null)
{
Assert::integerish($body, self::MSG);
Assert::greaterThanEq($body, 0, self::MSG);
Assert::notNull($descriptionFactory);
return new static($descriptionFactory->create($body, $context));
}
示例2: __construct
/**
* Creates a new version list.
*
* @param string $path The Puli path.
* @param PuliResource[] $versions The versions of the resource, starting
* with the first.
*/
public function __construct($path, array $versions)
{
Assert::stringNotEmpty($path, 'The Puli path must be a non-empty string. Got: %s');
Assert::allIsInstanceOf($versions, 'Puli\\Repository\\Api\\Resource\\PuliResource');
Assert::greaterThanEq(count($versions), 1, 'Expected at least one version.');
$this->path = $path;
$this->versions = array_values($versions);
}
示例3: decrease
/**
* {@inheritdoc}
*/
public function decrease(OrderInterface $order)
{
/** @var OrderItemInterface $orderItem */
foreach ($order->getItems() as $orderItem) {
$variant = $orderItem->getVariant();
if ($variant->isTracked()) {
Assert::greaterThanEq($variant->getOnHold() - $orderItem->getQuantity(), 0, sprintf('Not enough units to decrease the inventory of a variant "%s".', $variant->getName()));
$variant->setOnHold($variant->getOnHold() - $orderItem->getQuantity());
}
}
}
示例4: reorder
/**
* {@inheritdoc}
*/
public function reorder($sourcePath, $position)
{
Assert::greaterThanEq($position, 0, 'Reorder position cannot be negative, got: %s');
$this->reorderNode($sourcePath, $position);
}