vendor/sylius/sylius/src/Sylius/Bundle/InventoryBundle/Templating/Helper/InventoryHelper.php line 29

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\InventoryBundle\Templating\Helper;
  12. use Sylius\Component\Inventory\Checker\AvailabilityCheckerInterface;
  13. use Sylius\Component\Inventory\Model\StockableInterface;
  14. use Symfony\Component\Templating\Helper\Helper;
  15. final class InventoryHelper extends Helper
  16. {
  17.     private AvailabilityCheckerInterface $checker;
  18.     public function __construct(AvailabilityCheckerInterface $checker)
  19.     {
  20.         $this->checker $checker;
  21.     }
  22.     public function isStockAvailable(StockableInterface $stockable): bool
  23.     {
  24.         return $this->checker->isStockAvailable($stockable);
  25.     }
  26.     public function isStockSufficient(StockableInterface $stockableint $quantity): bool
  27.     {
  28.         return $this->checker->isStockSufficient($stockable$quantity);
  29.     }
  30.     public function getName(): string
  31.     {
  32.         return 'sylius_inventory';
  33.     }
  34. }