Conditions | 4 |
Paths | 6 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | public function match($name, $args, \DomElement $element) { |
||
14 | if ($element->parentNode !== $this->lastParentNode) $this->count = 0; |
||
15 | |||
16 | $this->lastParentNode = $element->parentNode; |
||
17 | |||
18 | |||
19 | |||
20 | if ($name !== 'nth-child') return true; |
||
21 | |||
22 | $this->count++; |
||
23 | $criteria = $args[0]; |
||
24 | |||
25 | if (is_callable([$this, $criteria])) return $this->$criteria($this->count); |
||
26 | $this->assert(is_numeric($criteria), "Argument passed to 'nth-child' must be 'odd', 'even', or of type int"); |
||
27 | return $this->count == $criteria; |
||
28 | } |
||
29 | |||
43 |