![]() 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/app/code/Ecombricks/InventoryCommon/Model/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See LICENSE.txt for license details. */ declare(strict_types=1); namespace Ecombricks\InventoryCommon\Model; /** * Get default stock */ class GetDefaultStock implements \Ecombricks\InventoryCommon\Api\GetDefaultStockInterface { /** * Stock repository * * @var \Magento\InventoryApi\Api\StockRepositoryInterface */ private $stockRepository; /** * Default stock provider * * @var \Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface */ private $defaultStockProvider; /** * Constructor * * @param \Magento\InventoryApi\Api\StockRepositoryInterface $stockRepository * @param \Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface $defaultStockProvider * @return void */ public function __construct( \Magento\InventoryApi\Api\StockRepositoryInterface $stockRepository, \Magento\InventoryCatalogApi\Api\DefaultStockProviderInterface $defaultStockProvider ) { $this->stockRepository = $stockRepository; $this->defaultStockProvider = $defaultStockProvider; } /** * Execute * * @return \Magento\InventoryApi\Api\Data\StockInterface */ public function execute(): \Magento\InventoryApi\Api\Data\StockInterface { return $this->stockRepository->get($this->defaultStockProvider->getId()); } }