Context.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\CatalogGraphQl\Model\Layer;
  8. use Magento\Catalog\Model\Layer\CollectionFilterInterface;
  9. use Magento\Catalog\Model\Layer\ItemCollectionProviderInterface;
  10. use Magento\Catalog\Model\Layer\StateKeyInterface;
  11. /**
  12. * Context for graphql layered navigation.
  13. */
  14. class Context implements \Magento\Catalog\Model\Layer\ContextInterface
  15. {
  16. /**
  17. * @var ItemCollectionProviderInterface
  18. */
  19. private $collectionProvider;
  20. /**
  21. * @var StateKeyInterface
  22. */
  23. private $stateKey;
  24. /**
  25. * @var CollectionFilterInterface
  26. */
  27. private $collectionFilter;
  28. /**
  29. * @param ItemCollectionProviderInterface $collectionProvider
  30. * @param StateKeyInterface $stateKey
  31. * @param CollectionFilterInterface $collectionFilter
  32. */
  33. public function __construct(
  34. ItemCollectionProviderInterface $collectionProvider,
  35. StateKeyInterface $stateKey,
  36. CollectionFilterInterface $collectionFilter
  37. ) {
  38. $this->collectionProvider = $collectionProvider;
  39. $this->stateKey = $stateKey;
  40. $this->collectionFilter = $collectionFilter;
  41. }
  42. /**
  43. * @return ItemCollectionProviderInterface
  44. */
  45. public function getCollectionProvider() : ItemCollectionProviderInterface
  46. {
  47. return $this->collectionProvider;
  48. }
  49. /**
  50. * @return StateKeyInterface
  51. */
  52. public function getStateKey() : StateKeyInterface
  53. {
  54. return $this->stateKey;
  55. }
  56. /**
  57. * @return CollectionFilterInterface
  58. */
  59. public function getCollectionFilter() : CollectionFilterInterface
  60. {
  61. return $this->collectionFilter;
  62. }
  63. }