@@ -15,11 +15,15 @@ discard block |
||
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 | foreach ($values[0] as $key => $iteration) { |
22 | - if ($count+1 > $max) break; |
|
24 | + if ($count+1 > $max) { |
|
25 | + break; |
|
26 | + } |
|
23 | 27 | $clone = $this->cloneElement($element, $iteration, $key, $count++); |
24 | 28 | //Re-run the hook on the new element, but use the iterated data |
25 | 29 | //Don't run repeat on the clones element or it will loop forever |
@@ -43,7 +47,9 @@ discard block |
||
43 | 47 | |
44 | 48 | private function tagElement($element, $count) { |
45 | 49 | //Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed |
46 | - if ($count > 0) $element->setAttribute('transphporm', 'added'); |
|
50 | + if ($count > 0) { |
|
51 | + $element->setAttribute('transphporm', 'added'); |
|
52 | + } |
|
47 | 53 | } |
48 | 54 | |
49 | 55 | private function getMax($values) { |
@@ -52,7 +58,9 @@ discard block |
||
52 | 58 | |
53 | 59 | private function createHook($newRules, $pseudoMatcher, $properties) { |
54 | 60 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet)); |
55 | - foreach ($properties as $name => $property) $hook->registerProperty($name, $property); |
|
61 | + foreach ($properties as $name => $property) { |
|
62 | + $hook->registerProperty($name, $property); |
|
63 | + } |
|
56 | 64 | return $hook; |
57 | 65 | } |
58 | 66 | } |
59 | 67 | \ No newline at end of file |