greaterThanEq() public static method

public static greaterThanEq ( $value, $limit, $message = '' )
Esempio n. 1
0
 /**
  * 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));
 }
Esempio n. 2
0
 /**
  * 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);
 }
 /**
  * {@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());
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function reorder($sourcePath, $position)
 {
     Assert::greaterThanEq($position, 0, 'Reorder position cannot be negative, got: %s');
     $this->reorderNode($sourcePath, $position);
 }