Proxy.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Config\Model\Config\Structure\Search;
  7. /**
  8. * @api
  9. * @since 100.0.2
  10. */
  11. class Proxy implements
  12. \Magento\Config\Model\Config\Structure\SearchInterface,
  13. \Magento\Framework\ObjectManager\NoninterceptableInterface
  14. {
  15. /**
  16. * Object manager
  17. * @var \Magento\Framework\ObjectManagerInterface
  18. */
  19. protected $_objectManager;
  20. /**
  21. * @var \Magento\Config\Model\Config\Structure
  22. */
  23. protected $_subject;
  24. /**
  25. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  26. */
  27. public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
  28. {
  29. $this->_objectManager = $objectManager;
  30. }
  31. /**
  32. * Retrieve subject
  33. *
  34. * @return \Magento\Config\Model\Config\Structure\SearchInterface
  35. */
  36. protected function _getSubject()
  37. {
  38. if (!$this->_subject) {
  39. $this->_subject = $this->_objectManager->get(\Magento\Config\Model\Config\Structure::class);
  40. }
  41. return $this->_subject;
  42. }
  43. /**
  44. * Find element by path
  45. *
  46. * @param string $path
  47. * @return \Magento\Config\Model\Config\Structure\ElementInterface|null
  48. */
  49. public function getElement($path)
  50. {
  51. return $this->_getSubject()->getElement($path);
  52. }
  53. }