Engine.php 827 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Search\Model\Adminhtml\System\Config\Source;
  7. /**
  8. * All registered search adapters
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Engine implements \Magento\Framework\Option\ArrayInterface
  14. {
  15. /**
  16. * Engines list
  17. *
  18. * @var array
  19. */
  20. private $engines;
  21. /**
  22. * Construct
  23. *
  24. * @param array $engines
  25. */
  26. public function __construct(
  27. array $engines
  28. ) {
  29. $this->engines = $engines;
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function toOptionArray()
  35. {
  36. $options = [];
  37. foreach ($this->engines as $key => $label) {
  38. $options[] = ['value' => $key, 'label' => $label];
  39. }
  40. return $options;
  41. }
  42. }