|
18 | 18 | * Layout merge model
|
19 | 19 | * @SuppressWarnings(PHPMD.TooManyFields)
|
20 | 20 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
| 21 | + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) |
21 | 22 | */
|
22 | 23 | class Merge implements \Magento\Framework\View\Layout\ProcessorInterface
|
23 | 24 | {
|
@@ -462,20 +463,7 @@ public function load($handles = [])
|
462 | 463 | return $this;
|
463 | 464 | }
|
464 | 465 |
|
465 |
| - // Walk all updates and extract handles before the merge step. |
466 |
| - foreach ($this->updates as $update) { |
467 |
| - $updateXml = null; |
468 |
| - |
469 |
| - try { |
470 |
| - $updateXml = $this->_loadXmlString($update); |
471 |
| - } catch (\Exception $exception) { |
472 |
| - // ignore invalid |
473 |
| - } |
474 |
| - |
475 |
| - if ($updateXml && strtolower($updateXml->getName()) == 'update' && isset($updateXml['handle'])) { |
476 |
| - $this->addHandle((string)$updateXml['handle']); |
477 |
| - } |
478 |
| - } |
| 466 | + $this->extractHandlers(); |
479 | 467 |
|
480 | 468 | foreach ($this->getHandles() as $handle) {
|
481 | 469 | $this->_merge($handle);
|
@@ -966,4 +954,25 @@ public function getCacheId()
|
966 | 954 | // phpcs:ignore Magento2.Security.InsecureFunction
|
967 | 955 | return $this->generateCacheId(md5(implode('|', array_merge($this->getHandles(), $layoutCacheKeys))));
|
968 | 956 | }
|
| 957 | + |
| 958 | + /** |
| 959 | + * Walk all updates and extract handles before the merge step. |
| 960 | + */ |
| 961 | + private function extractHandlers(): void |
| 962 | + { |
| 963 | + foreach ($this->updates as $update) { |
| 964 | + $updateXml = null; |
| 965 | + |
| 966 | + try { |
| 967 | + $updateXml = $this->_loadXmlString($update); |
| 968 | + // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock |
| 969 | + } catch (\Exception $exception) { |
| 970 | + // ignore invalid |
| 971 | + } |
| 972 | + |
| 973 | + if ($updateXml && strtolower($updateXml->getName()) == 'update' && isset($updateXml['handle'])) { |
| 974 | + $this->addHandle((string)$updateXml['handle']); |
| 975 | + } |
| 976 | + } |
| 977 | + } |
969 | 978 | }
|
0 commit comments