OptionHash.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Model\Config\Source\Website;
  7. use Magento\Framework\Option\ArrayInterface;
  8. use Magento\Store\Model\System\Store;
  9. /**
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class OptionHash implements ArrayInterface
  14. {
  15. /**
  16. * System Store Model
  17. *
  18. * @var Store
  19. */
  20. protected $_systemStore;
  21. /**
  22. * @var bool True if the default website (Admin) should be included
  23. */
  24. protected $_withDefaultWebsite;
  25. /**
  26. * @param Store $systemStore
  27. * @param bool $withDefaultWebsite
  28. */
  29. public function __construct(Store $systemStore, $withDefaultWebsite = false)
  30. {
  31. $this->_systemStore = $systemStore;
  32. $this->_withDefaultWebsite = $withDefaultWebsite;
  33. }
  34. /**
  35. * Return websites array
  36. *
  37. * @return array
  38. */
  39. public function toOptionArray()
  40. {
  41. return $this->_systemStore->getWebsiteOptionHash($this->_withDefaultWebsite);
  42. }
  43. }