Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RequestCheckerComposite.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $categoryRepository;
21 
25  private $storeManager;
26 
30  private $queryCheckers;
31 
38  public function __construct(
39  CategoryRepositoryInterface $categoryRepository,
40  StoreManagerInterface $storeManager,
41  array $queryCheckers
42  ) {
43  $this->categoryRepository = $categoryRepository;
44  $this->storeManager = $storeManager;
45  $this->queryCheckers = $queryCheckers;
46 
47  foreach ($this->queryCheckers as $queryChecker) {
48  if (!$queryChecker instanceof RequestCheckerInterface) {
49  throw new \InvalidArgumentException(
50  get_class($queryChecker) .
51  ' does not implement ' .
52  \Magento\CatalogSearch\Model\Adapter\Aggregation\RequestCheckerInterface::class
53  );
54  }
55  }
56  }
57 
61  public function isApplicable(RequestInterface $request)
62  {
63  $result = true;
64 
65  foreach ($this->queryCheckers as $item) {
67  $result = $item->isApplicable($request);
68  if (!$result) {
69  break;
70  }
71  }
72 
73  return $result;
74  }
75 }
$storeManager
__construct(CategoryRepositoryInterface $categoryRepository, StoreManagerInterface $storeManager, array $queryCheckers)