Completed
Push — master ( 7b17ad...a29029 )
by Tom
02:30
created
src/Property/Repeat.php 1 patch
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,14 +15,18 @@  discard block
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) {
18
-		if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element);
18
+		if ($element->getAttribute('transphporm') === 'added') {
19
+			return $element->parentNode->removeChild($element);
20
+		}
19 21
 		$max = $this->getMax($values);
20 22
 		$count = 0;
21 23
 
22 24
 		//What was this if statement for? removing it breaks nothing
23 25
 		//if (empty($values[0])) $values[0] = [];
24 26
 		foreach ($values[0] as $key => $iteration) {
25
-			if ($count+1 > $max) break;
27
+			if ($count+1 > $max) {
28
+				break;
29
+			}
26 30
 			$clone = $this->cloneElement($element, $iteration, $key, $count++);
27 31
 			//Re-run the hook on the new element, but use the iterated data
28 32
 			//Don't run repeat on the clones element or it will loop forever
@@ -46,7 +50,9 @@  discard block
 block discarded – undo
46 50
 
47 51
 	private function tagElement($element, $count) {
48 52
 		//Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed
49
-		if ($count > 0) $element->setAttribute('transphporm', 'added');
53
+		if ($count > 0) {
54
+			$element->setAttribute('transphporm', 'added');
55
+		}
50 56
 	}
51 57
 
52 58
 	private function getMax($values) {
@@ -55,7 +61,9 @@  discard block
 block discarded – undo
55 61
 
56 62
 	private function createHook($newRules, $pseudoMatcher, $properties) {
57 63
 		$hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet), $this->functionSet);
58
-		foreach ($properties as $name => $property) $hook->registerProperty($name, $property);
64
+		foreach ($properties as $name => $property) {
65
+			$hook->registerProperty($name, $property);
66
+		}
59 67
 		return $hook;
60 68
 	}
61 69
 }
Please login to merge, or discard this patch.