AbstractMapper.php 838 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * System Configuration Converter Mapper Interface
  8. */
  9. namespace Magento\Config\Model\Config\Structure;
  10. /**
  11. * @api
  12. * @since 100.0.2
  13. */
  14. abstract class AbstractMapper implements MapperInterface
  15. {
  16. /**
  17. * Check value existence
  18. *
  19. * @param string $key
  20. * @param array $target
  21. * @return bool
  22. */
  23. protected function _hasValue($key, $target)
  24. {
  25. if (false == is_array($target)) {
  26. return false;
  27. }
  28. $paths = explode('/', $key);
  29. foreach ($paths as $path) {
  30. if (array_key_exists($path, $target)) {
  31. $target = $target[$path];
  32. } else {
  33. return false;
  34. }
  35. }
  36. return true;
  37. }
  38. }