Unitofmeasure.php 729 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ups\Model\Config\Source;
  7. /**
  8. * Class Unitofmeasure
  9. */
  10. class Unitofmeasure extends \Magento\Ups\Model\Config\Source\Generic
  11. {
  12. /**
  13. * Carrier code
  14. *
  15. * @var string
  16. */
  17. protected $_code = 'unit_of_measure';
  18. /**
  19. * {@inheritdoc}
  20. * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  21. */
  22. public function toOptionArray()
  23. {
  24. $unitArr = $this->carrierConfig->getCode($this->_code);
  25. $returnArr = [];
  26. foreach ($unitArr as $key => $val) {
  27. $returnArr[] = ['value' => $key, 'label' => $key];
  28. }
  29. return $returnArr;
  30. }
  31. }