Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NodePathMatcher.php
Go to the documentation of this file.
1 <?php
7 
12 {
20  public function match($pathPattern, $xpathSubject)
21  {
22  $pathSubject = $this->simplifyXpath($xpathSubject);
23  $pathPattern = '#^' . $pathPattern . '$#';
24  return (bool)preg_match($pathPattern, $pathSubject);
25  }
26 
33  protected function simplifyXpath($xpath)
34  {
35  $result = $xpath;
36  $result = preg_replace('/\[@[^\]]+?\]/', '', $result);
37  $result = preg_replace('/\/[^:]+?\:/', '/', $result);
38  return $result;
39  }
40 }
$pathPattern