Conditions | 5 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | public function match($pseudo, \DomElement $element) { |
||
16 | if (strpos($pseudo, 'not') === 0) { |
||
17 | $valueParser = new \Transphporm\Parser\Value($this->dataFunction); |
||
18 | $bracketMatcher = new \Transphporm\Parser\BracketMatcher($pseudo); |
||
19 | $css = explode(',', $bracketMatcher->match('(', ')')); |
||
20 | |||
21 | foreach ($css as $selector) { |
||
22 | $cssToXpath = new \Transphporm\Parser\CssToXpath($selector, $valueParser); |
||
23 | $xpathString = $cssToXpath->getXpath(); |
||
24 | $xpath = new \DomXpath($element->ownerDocument); |
||
25 | |||
26 | foreach ($xpath->query($xpathString) as $matchedElement) { |
||
27 | if ($element->isSameNode($matchedElement)) return false; |
||
28 | } |
||
29 | } |
||
30 | } |
||
31 | return true; |
||
32 | } |
||
33 | } |