Config.php 1008 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Model\SearchEngine;
  7. class Config implements \Magento\Framework\Search\SearchEngine\ConfigInterface
  8. {
  9. /**
  10. * Search engine config data storage
  11. *
  12. * @var Config\Data
  13. */
  14. protected $dataStorage;
  15. /**
  16. * Constructor
  17. *
  18. * @param \Magento\Framework\Config\DataInterface $dataStorage
  19. */
  20. public function __construct(\Magento\Framework\Config\DataInterface $dataStorage)
  21. {
  22. $this->dataStorage = $dataStorage;
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function getDeclaredFeatures($searchEngine)
  28. {
  29. return $this->dataStorage->get($searchEngine, []);
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function isFeatureSupported($featureName, $searchEngine)
  35. {
  36. $features = $this->getDeclaredFeatures($searchEngine);
  37. return in_array(strtolower($featureName), $features);
  38. }
  39. }