Proxy.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\View\Layout;
  7. /**
  8. * Proxy class for @see \Magento\Framework\View\Layout
  9. * @SuppressWarnings(PHPMD.ExcessivePublicCount)
  10. */
  11. class Proxy extends \Magento\Framework\View\Layout implements \Magento\Framework\ObjectManager\NoninterceptableInterface
  12. {
  13. /**
  14. * Object Manager instance
  15. *
  16. * @var \Magento\Framework\ObjectManagerInterface
  17. */
  18. protected $_objectManager = null;
  19. /**
  20. * Proxied instance name
  21. *
  22. * @var string
  23. */
  24. protected $_instanceName = null;
  25. /**
  26. * Proxied instance
  27. *
  28. * @var \Magento\Framework\View\Layout
  29. */
  30. protected $_subject = null;
  31. /**
  32. * Instance shareability flag
  33. *
  34. * @var bool
  35. */
  36. protected $_isShared = null;
  37. /**
  38. * Proxy constructor
  39. *
  40. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  41. * @param string $instanceName
  42. * @param bool $shared
  43. */
  44. public function __construct(
  45. \Magento\Framework\ObjectManagerInterface $objectManager,
  46. $instanceName = \Magento\Framework\View\Layout::class,
  47. $shared = true
  48. ) {
  49. $this->_objectManager = $objectManager;
  50. $this->_instanceName = $instanceName;
  51. $this->_isShared = $shared;
  52. }
  53. /**
  54. * @return array
  55. */
  56. public function __sleep()
  57. {
  58. return ['_subject', '_isShared'];
  59. }
  60. /**
  61. * Retrieve ObjectManager from global scope
  62. *
  63. * @return void
  64. */
  65. public function __wakeup()
  66. {
  67. $this->_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
  68. }
  69. /**
  70. * Clone proxied instance
  71. *
  72. * @return void
  73. */
  74. public function __clone()
  75. {
  76. $this->_subject = clone $this->_getSubject();
  77. }
  78. /**
  79. * Get proxied instance
  80. *
  81. * @return \Magento\Framework\View\Layout
  82. */
  83. protected function _getSubject()
  84. {
  85. if (!$this->_subject) {
  86. $this->_subject = true === $this->_isShared
  87. ? $this->_objectManager->get($this->_instanceName)
  88. : $this->_objectManager->create($this->_instanceName);
  89. }
  90. return $this->_subject;
  91. }
  92. /**
  93. * {@inheritdoc}
  94. */
  95. public function setGeneratorPool(\Magento\Framework\View\Layout\GeneratorPool $generatorPool)
  96. {
  97. return $this->_getSubject()->setGeneratorPool($generatorPool);
  98. }
  99. /**
  100. * {@inheritdoc}
  101. */
  102. public function setBuilder(\Magento\Framework\View\Layout\BuilderInterface $builder)
  103. {
  104. return $this->_getSubject()->setBuilder($builder);
  105. }
  106. /**
  107. * {@inheritdoc}
  108. */
  109. public function publicBuild()
  110. {
  111. $this->_getSubject()->publicBuild();
  112. }
  113. /**
  114. * {@inheritdoc}
  115. */
  116. public function getUpdate()
  117. {
  118. return $this->_getSubject()->getUpdate();
  119. }
  120. /**
  121. * {@inheritdoc}
  122. */
  123. public function generateXml()
  124. {
  125. return $this->_getSubject()->generateXml();
  126. }
  127. /**
  128. * {@inheritdoc}
  129. */
  130. public function generateElements()
  131. {
  132. $this->_getSubject()->generateElements();
  133. }
  134. /**
  135. * {@inheritdoc}
  136. */
  137. public function getChildBlock($parentName, $alias)
  138. {
  139. return $this->_getSubject()->getChildBlock($parentName, $alias);
  140. }
  141. /**
  142. * {@inheritdoc}
  143. */
  144. public function setChild($parentName, $elementName, $alias)
  145. {
  146. return $this->_getSubject()->setChild($parentName, $elementName, $alias);
  147. }
  148. /**
  149. * {@inheritdoc}
  150. */
  151. public function reorderChild($parentName, $childName, $offsetOrSibling, $after = true)
  152. {
  153. $this->_getSubject()->reorderChild($parentName, $childName, $offsetOrSibling, $after);
  154. }
  155. /**
  156. * {@inheritdoc}
  157. */
  158. public function unsetChild($parentName, $alias)
  159. {
  160. return $this->_getSubject()->unsetChild($parentName, $alias);
  161. }
  162. /**
  163. * {@inheritdoc}
  164. */
  165. public function getChildNames($parentName)
  166. {
  167. return $this->_getSubject()->getChildNames($parentName);
  168. }
  169. /**
  170. * {@inheritdoc}
  171. */
  172. public function getChildBlocks($parentName)
  173. {
  174. return $this->_getSubject()->getChildBlocks($parentName);
  175. }
  176. /**
  177. * {@inheritdoc}
  178. */
  179. public function getChildName($parentName, $alias)
  180. {
  181. return $this->_getSubject()->getChildName($parentName, $alias);
  182. }
  183. /**
  184. * {@inheritdoc}
  185. */
  186. public function renderElement($name, $useCache = true)
  187. {
  188. return $this->_getSubject()->renderElement($name, $useCache);
  189. }
  190. /**
  191. * {@inheritdoc}
  192. */
  193. public function renderNonCachedElement($name)
  194. {
  195. return $this->_getSubject()->renderNonCachedElement($name);
  196. }
  197. /**
  198. * {@inheritdoc}
  199. */
  200. public function addToParentGroup($blockName, $parentGroupName)
  201. {
  202. return $this->_getSubject()->addToParentGroup($blockName, $parentGroupName);
  203. }
  204. /**
  205. * {@inheritdoc}
  206. */
  207. public function getGroupChildNames($blockName, $groupName)
  208. {
  209. return $this->_getSubject()->getGroupChildNames($blockName, $groupName);
  210. }
  211. /**
  212. * {@inheritdoc}
  213. */
  214. public function hasElement($name)
  215. {
  216. return $this->_getSubject()->hasElement($name);
  217. }
  218. /**
  219. * {@inheritdoc}
  220. */
  221. public function getElementProperty($name, $attribute)
  222. {
  223. return $this->_getSubject()->getElementProperty($name, $attribute);
  224. }
  225. /**
  226. * {@inheritdoc}
  227. */
  228. public function isBlock($name)
  229. {
  230. return $this->_getSubject()->isBlock($name);
  231. }
  232. /**
  233. * {@inheritdoc}
  234. */
  235. public function isUiComponent($name)
  236. {
  237. return $this->_getSubject()->isUiComponent($name);
  238. }
  239. /**
  240. * {@inheritdoc}
  241. */
  242. public function isContainer($name)
  243. {
  244. return $this->_getSubject()->isContainer($name);
  245. }
  246. /**
  247. * {@inheritdoc}
  248. */
  249. public function isManipulationAllowed($name)
  250. {
  251. return $this->_getSubject()->isManipulationAllowed($name);
  252. }
  253. /**
  254. * {@inheritdoc}
  255. */
  256. public function setBlock($name, $block)
  257. {
  258. return $this->_getSubject()->setBlock($name, $block);
  259. }
  260. /**
  261. * {@inheritdoc}
  262. */
  263. public function unsetElement($name)
  264. {
  265. return $this->_getSubject()->unsetElement($name);
  266. }
  267. /**
  268. * {@inheritdoc}
  269. */
  270. public function createBlock($type, $name = '', array $arguments = [])
  271. {
  272. return $this->_getSubject()->createBlock($type, $name, $arguments);
  273. }
  274. /**
  275. * {@inheritdoc}
  276. */
  277. public function addBlock($block, $name = '', $parent = '', $alias = '')
  278. {
  279. return $this->_getSubject()->addBlock($block, $name, $parent, $alias);
  280. }
  281. /**
  282. * {@inheritdoc}
  283. */
  284. public function addContainer($name, $label, array $options = [], $parent = '', $alias = '')
  285. {
  286. $this->_getSubject()->addContainer($name, $label, $options, $parent, $alias);
  287. }
  288. /**
  289. * {@inheritdoc}
  290. */
  291. public function renameElement($oldName, $newName)
  292. {
  293. return $this->_getSubject()->renameElement($oldName, $newName);
  294. }
  295. /**
  296. * {@inheritdoc}
  297. */
  298. public function getAllBlocks()
  299. {
  300. return $this->_getSubject()->getAllBlocks();
  301. }
  302. /**
  303. * {@inheritdoc}
  304. */
  305. public function getBlock($name)
  306. {
  307. return $this->_getSubject()->getBlock($name);
  308. }
  309. /**
  310. * {@inheritdoc}
  311. */
  312. public function getUiComponent($name)
  313. {
  314. return $this->_getSubject()->getUiComponent($name);
  315. }
  316. /**
  317. * {@inheritdoc}
  318. */
  319. public function getParentName($childName)
  320. {
  321. return $this->_getSubject()->getParentName($childName);
  322. }
  323. /**
  324. * {@inheritdoc}
  325. */
  326. public function getElementAlias($name)
  327. {
  328. return $this->_getSubject()->getElementAlias($name);
  329. }
  330. /**
  331. * {@inheritdoc}
  332. */
  333. public function addOutputElement($name)
  334. {
  335. return $this->_getSubject()->addOutputElement($name);
  336. }
  337. /**
  338. * {@inheritdoc}
  339. */
  340. public function removeOutputElement($name)
  341. {
  342. return $this->_getSubject()->removeOutputElement($name);
  343. }
  344. /**
  345. * {@inheritdoc}
  346. */
  347. public function getOutput()
  348. {
  349. return $this->_getSubject()->getOutput();
  350. }
  351. /**
  352. * {@inheritdoc}
  353. */
  354. public function getMessagesBlock()
  355. {
  356. return $this->_getSubject()->getMessagesBlock();
  357. }
  358. /**
  359. * {@inheritdoc}
  360. */
  361. public function getBlockSingleton($type)
  362. {
  363. return $this->_getSubject()->getBlockSingleton($type);
  364. }
  365. /**
  366. * {@inheritdoc}
  367. */
  368. public function addAdjustableRenderer($namespace, $staticType, $dynamicType, $type, $template, $data = [])
  369. {
  370. return $this->_getSubject()->addAdjustableRenderer(
  371. $namespace,
  372. $staticType,
  373. $dynamicType,
  374. $type,
  375. $template,
  376. $data
  377. );
  378. }
  379. /**
  380. * {@inheritdoc}
  381. */
  382. public function getRendererOptions($namespace, $staticType, $dynamicType)
  383. {
  384. return $this->_getSubject()->getRendererOptions($namespace, $staticType, $dynamicType);
  385. }
  386. /**
  387. * {@inheritdoc}
  388. */
  389. public function executeRenderer($namespace, $staticType, $dynamicType, $data = [])
  390. {
  391. $this->_getSubject()->executeRenderer($namespace, $staticType, $dynamicType, $data);
  392. }
  393. /**
  394. * {@inheritdoc}
  395. */
  396. public function initMessages($messageGroups = [])
  397. {
  398. $this->_getSubject()->initMessages($messageGroups);
  399. }
  400. /**
  401. * {@inheritdoc}
  402. */
  403. public function isCacheable()
  404. {
  405. return $this->_getSubject()->isCacheable();
  406. }
  407. /**
  408. * {@inheritdoc}
  409. */
  410. public function isPrivate()
  411. {
  412. return $this->_getSubject()->isPrivate();
  413. }
  414. /**
  415. * {@inheritdoc}
  416. */
  417. public function setIsPrivate($isPrivate = true)
  418. {
  419. return $this->_getSubject()->setIsPrivate($isPrivate);
  420. }
  421. /**
  422. * {@inheritdoc}
  423. */
  424. public function getReaderContext()
  425. {
  426. return $this->_getSubject()->getReaderContext();
  427. }
  428. /**
  429. * {@inheritdoc}
  430. */
  431. public function setXml(\Magento\Framework\Simplexml\Element $node)
  432. {
  433. return $this->_getSubject()->setXml($node);
  434. }
  435. /**
  436. * {@inheritdoc}
  437. */
  438. public function getNode($path = null)
  439. {
  440. return $this->_getSubject()->getNode($path);
  441. }
  442. /**
  443. * {@inheritdoc}
  444. */
  445. public function getXpath($xpath)
  446. {
  447. return $this->_getSubject()->getXpath($xpath);
  448. }
  449. /**
  450. * {@inheritdoc}
  451. */
  452. public function getXmlString()
  453. {
  454. return $this->_getSubject()->getXmlString();
  455. }
  456. /**
  457. * {@inheritdoc}
  458. */
  459. public function loadFile($filePath)
  460. {
  461. return $this->_getSubject()->loadFile($filePath);
  462. }
  463. /**
  464. * {@inheritdoc}
  465. */
  466. public function loadString($string)
  467. {
  468. return $this->_getSubject()->loadString($string);
  469. }
  470. /**
  471. * {@inheritdoc}
  472. */
  473. public function loadDom(\DOMNode $dom)
  474. {
  475. return $this->_getSubject()->loadDom($dom);
  476. }
  477. /**
  478. * {@inheritdoc}
  479. */
  480. public function setNode($path, $value, $overwrite = true)
  481. {
  482. return $this->_getSubject()->setNode($path, $value, $overwrite);
  483. }
  484. /**
  485. * {@inheritdoc}
  486. */
  487. public function applyExtends()
  488. {
  489. return $this->_getSubject()->applyExtends();
  490. }
  491. /**
  492. * {@inheritdoc}
  493. */
  494. public function processFileData($text)
  495. {
  496. return $this->_getSubject()->processFileData($text);
  497. }
  498. /**
  499. * {@inheritdoc}
  500. */
  501. public function extend(\Magento\Framework\Simplexml\Config $config, $overwrite = true)
  502. {
  503. return $this->_getSubject()->extend($config, $overwrite);
  504. }
  505. }