Config.php 836 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Indexer\Model;
  7. use Magento\Framework\Indexer\ConfigInterface;
  8. class Config implements ConfigInterface
  9. {
  10. /**
  11. * @var Config\Data
  12. */
  13. protected $configData;
  14. /**
  15. * @param Config\Data $configData
  16. */
  17. public function __construct(Config\Data $configData)
  18. {
  19. $this->configData = $configData;
  20. }
  21. /**
  22. * Get indexers list
  23. *
  24. * @return array[]
  25. */
  26. public function getIndexers()
  27. {
  28. return $this->configData->get();
  29. }
  30. /**
  31. * Get indexer by ID
  32. *
  33. * @param string $indexerId
  34. * @return array
  35. */
  36. public function getIndexer($indexerId)
  37. {
  38. return $this->configData->get($indexerId) ?: [];
  39. }
  40. }