Skip to content

Commit a681509

Browse files
#23918:Static test fix.
1 parent 4810c1d commit a681509

File tree

1 file changed

+23
-14
lines changed
  • lib/internal/Magento/Framework/View/Model/Layout

1 file changed

+23
-14
lines changed

lib/internal/Magento/Framework/View/Model/Layout/Merge.php

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* Layout merge model
1919
* @SuppressWarnings(PHPMD.TooManyFields)
2020
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2122
*/
2223
class Merge implements \Magento\Framework\View\Layout\ProcessorInterface
2324
{
@@ -462,20 +463,7 @@ public function load($handles = [])
462463
return $this;
463464
}
464465

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();
479467

480468
foreach ($this->getHandles() as $handle) {
481469
$this->_merge($handle);
@@ -966,4 +954,25 @@ public function getCacheId()
966954
// phpcs:ignore Magento2.Security.InsecureFunction
967955
return $this->generateCacheId(md5(implode('|', array_merge($this->getHandles(), $layoutCacheKeys))));
968956
}
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+
}
969978
}

0 commit comments

Comments
 (0)