Yesno.php 636 B

123456789101112131415161718192021222324252627282930313233
  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;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Yesno implements \Magento\Framework\Option\ArrayInterface
  12. {
  13. /**
  14. * Options getter
  15. *
  16. * @return array
  17. */
  18. public function toOptionArray()
  19. {
  20. return [['value' => 1, 'label' => __('Yes')], ['value' => 0, 'label' => __('No')]];
  21. }
  22. /**
  23. * Get options in "key-value" format
  24. *
  25. * @return array
  26. */
  27. public function toArray()
  28. {
  29. return [0 => __('No'), 1 => __('Yes')];
  30. }
  31. }