| Conditions | 5 |
| Paths | 8 |
| 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 | else if (!is_numeric($criteria)) throw new \Exception("Argument passed to 'nth-child' must be 'odd', 'even', or of type int"); |
||
| 27 | else return $this->count == $criteria; |
||
| 28 | } |
||
| 29 | |||
| 38 |