Completed
Push — master ( d42201...aa2fa2 )
by Tom
03:09
created
src/Pseudo/Nth.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,20 +11,28 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.