PropertyMapperAbstract.php 712 B

123456789101112131415161718192021222324252627
  1. <?php
  2. /**
  3. * Abstract attribute property mapper
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Eav\Model\Entity\Setup;
  9. abstract class PropertyMapperAbstract implements PropertyMapperInterface
  10. {
  11. /**
  12. * Retrieve value from array by key or return default value
  13. *
  14. * @param array $array
  15. * @param string $key
  16. * @param string $default
  17. * @return string
  18. */
  19. protected function _getValue($array, $key, $default = null)
  20. {
  21. if (isset($array[$key]) && is_bool($array[$key])) {
  22. $array[$key] = (int)$array[$key];
  23. }
  24. return isset($array[$key]) ? $array[$key] : $default;
  25. }
  26. }