![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Config/Dom/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Framework\Config\Dom; /** * Matching of XPath expressions to path patterns */ class NodePathMatcher { /** * Whether a subject XPath matches to a given path pattern * * @param string $pathPattern Example: '/some/static/path' or '/some/regexp/path(/item)+' * @param string $xpathSubject Example: '/some[@attr="value"]/static/ns:path' * @return bool */ public function match($pathPattern, $xpathSubject) { $pathSubject = $this->simplifyXpath($xpathSubject); $pathPattern = '#^' . $pathPattern . '$#'; return (bool)preg_match($pathPattern, $pathSubject); } /** * Strip off predicates and namespaces from the XPath * * @param string $xpath * @return string */ protected function simplifyXpath($xpath) { $result = $xpath ?: ''; $result = preg_replace('/\[@[^\]]+?\]/', '', $result); return preg_replace('/\/[^:]+?\:/', '/', $result); } }