Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Proxy.php
Go to the documentation of this file.
1 <?php
7 
11 class Proxy extends \Magento\Framework\Mview\Config\Data implements
13 {
19  protected $objectManager;
20 
26  protected $instanceName;
27 
33  protected $subject;
34 
40  protected $isShared = null;
41 
47  public function __construct(
49  $instanceName = \Magento\Framework\Mview\Config\Data::class,
50  $shared = true
51  ) {
52  $this->objectManager = $objectManager;
53  $this->instanceName = $instanceName;
54  $this->isShared = $shared;
55  }
56 
60  public function __sleep()
61  {
62  return ['subject', 'isShared'];
63  }
64 
70  public function __wakeup()
71  {
73  }
74 
80  public function __clone()
81  {
82  $this->subject = clone $this->_getSubject();
83  }
84 
90  protected function _getSubject()
91  {
92  if (!$this->subject) {
93  $this->subject = true === $this->isShared ? $this->objectManager->get(
94  $this->instanceName
95  ) : $this->objectManager->create(
96  $this->instanceName
97  );
98  }
99  return $this->subject;
100  }
101 
105  public function merge(array $config)
106  {
107  $this->_getSubject()->merge($config);
108  }
109 
113  public function get($path = null, $default = null)
114  {
115  return $this->_getSubject()->get($path, $default);
116  }
117 }
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName=\Magento\Framework\Mview\Config\Data::class, $shared=true)
Definition: Proxy.php:47
$config
Definition: fraud_order.php:17