![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-inventory-sales/Model/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\InventorySales\Model; use Magento\InventoryConfigurationApi\Api\GetStockItemConfigurationInterface; use Magento\InventoryReservationsApi\Model\GetReservationsQuantityInterface; use Magento\InventorySalesApi\Model\GetSalableQtyInterface; use Magento\InventorySalesApi\Model\GetStockItemDataInterface; /** * @inheritdoc */ class GetSalableQty implements GetSalableQtyInterface { /** * @var GetStockItemConfigurationInterface */ private $getStockItemConfiguration; /** * @var GetReservationsQuantityInterface */ private $getReservationsQuantity; /** * @var GetStockItemDataInterface */ private $getProductAvailableQty; /** * @param GetStockItemConfigurationInterface $getStockItemConfig * @param GetReservationsQuantityInterface $getReservationsQuantity * @param GetProductAvailableQty $getProductAvailableQty */ public function __construct( GetStockItemConfigurationInterface $getStockItemConfig, GetReservationsQuantityInterface $getReservationsQuantity, GetProductAvailableQty $getProductAvailableQty ) { $this->getStockItemConfiguration = $getStockItemConfig; $this->getReservationsQuantity = $getReservationsQuantity; $this->getProductAvailableQty = $getProductAvailableQty; } /** * @inheritdoc */ public function execute(string $sku, int $stockId): float { $stockItemConfig = $this->getStockItemConfiguration->execute($sku, $stockId); return $this->getProductAvailableQty->execute($sku, $stockId) + $this->getReservationsQuantity->execute($sku, $stockId) - $stockItemConfig->getMinQty(); } }