@@ -11,20 +11,28 @@ |
||
| 11 | 11 | private $lastParentNode; |
| 12 | 12 | |
| 13 | 13 | public function match($name, $args, \DomElement $element) { |
| 14 | - if ($element->parentNode !== $this->lastParentNode) $this->count = 0; |
|
| 14 | + if ($element->parentNode !== $this->lastParentNode) { |
|
| 15 | + $this->count = 0; |
|
| 16 | + } |
|
| 15 | 17 | |
| 16 | 18 | $this->lastParentNode = $element->parentNode; |
| 17 | 19 | |
| 18 | 20 | |
| 19 | 21 | |
| 20 | - if ($name !== 'nth-child') return true; |
|
| 22 | + if ($name !== 'nth-child') { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 21 | 25 | |
| 22 | 26 | $this->count++; |
| 23 | 27 | $criteria = $args[0]; |
| 24 | 28 | |
| 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; |
|
| 29 | + if (is_callable([$this, $criteria])) { |
|
| 30 | + return $this->$criteria($this->count); |
|
| 31 | + } else if (!is_numeric($criteria)) { |
|
| 32 | + throw new \Exception("Argument passed to 'nth-child' must be 'odd', 'even', or of type int"); |
|
| 33 | + } else { |
|
| 34 | + return $this->count == $criteria; |
|
| 35 | + } |
|
| 28 | 36 | } |
| 29 | 37 | |
| 30 | 38 | private function odd($num) { |