Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
StockProcessor.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
15 
22 {
26  private $stockConfig;
27 
31  private $stockStatusResource;
32 
37  public function __construct(StockConfigurationInterface $stockConfig, StockStatusResource $stockStatusResource)
38  {
39  $this->stockConfig = $stockConfig;
40  $this->stockStatusResource = $stockStatusResource;
41  }
42 
46  public function process(
49  array $attributeNames
50  ): Collection {
51  if (!$this->stockConfig->isShowOutOfStock()) {
52  $this->stockStatusResource->addIsInStockFilterToCollection($collection);
53  }
54 
55  return $collection;
56  }
57 }
__construct(StockConfigurationInterface $stockConfig, StockStatusResource $stockStatusResource)
process(Collection $collection, SearchCriteriaInterface $searchCriteria, array $attributeNames)
$searchCriteria