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