@@ -9,13 +9,13 @@ |
||
9 | 9 | private $functionSet; |
10 | 10 | private $elementData; |
11 | 11 | private $line; |
12 | - private $filePath; |
|
12 | + private $filePath; |
|
13 | 13 | |
14 | 14 | public function __construct(\Transphporm\FunctionSet $functionSet, \Transphporm\Hook\ElementData $elementData, &$line, \Transphporm\FilePath $filePath) { |
15 | 15 | $this->functionSet = $functionSet; |
16 | 16 | $this->elementData = $elementData; |
17 | 17 | $this->line = &$line; |
18 | - $this->filePath = $filePath; |
|
18 | + $this->filePath = $filePath; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | public function run(array $values, \DomElement $element, array $rules, \Transphporm\Hook\PseudoMatcher $pseudoMatcher, array $properties = []) { |
24 | 24 | $values = $this->fixEmpty($values); |
25 | - if ($element->getAttribute('transphporm') === 'added') return $element->parentNode->removeChild($element); |
|
25 | + if ($element->getAttribute('transphporm') === 'added') { |
|
26 | + return $element->parentNode->removeChild($element); |
|
27 | + } |
|
26 | 28 | $this->handleContentModeAppend($element, $rules); |
27 | 29 | $max = $this->getMax($values); |
28 | 30 | $count = 0; |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | $hook = $this->createHook($rules, $pseudoMatcher, $properties); |
33 | 35 | |
34 | 36 | foreach ($repeat as $key => $iteration) { |
35 | - if ($count+1 > $max) break; |
|
37 | + if ($count+1 > $max) { |
|
38 | + break; |
|
39 | + } |
|
36 | 40 | $clone = $this->cloneElement($element, $iteration, $key, $count++); |
37 | 41 | //Re-run the hook on the new element, but use the iterated data |
38 | 42 | $hook->run($clone); |
@@ -68,7 +72,9 @@ discard block |
||
68 | 72 | } |
69 | 73 | |
70 | 74 | private function fixEmpty($value) { |
71 | - if (empty($value[0])) $value[0] = []; |
|
75 | + if (empty($value[0])) { |
|
76 | + $value[0] = []; |
|
77 | + } |
|
72 | 78 | return $value; |
73 | 79 | } |
74 | 80 | |
@@ -84,7 +90,9 @@ discard block |
||
84 | 90 | |
85 | 91 | private function tagElement($element, $count) { |
86 | 92 | //Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed |
87 | - if ($count > 0) $element->setAttribute('transphporm', 'added'); |
|
93 | + if ($count > 0) { |
|
94 | + $element->setAttribute('transphporm', 'added'); |
|
95 | + } |
|
88 | 96 | } |
89 | 97 | |
90 | 98 | private function getMax($values) { |
@@ -93,7 +101,9 @@ discard block |
||
93 | 101 | |
94 | 102 | private function createHook($newRules, $pseudoMatcher, $properties) { |
95 | 103 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $this->line, null, $this->line, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet), $this->functionSet, $this->filePath); |
96 | - foreach ($properties as $name => $property) $hook->registerProperty($name, $property); |
|
104 | + foreach ($properties as $name => $property) { |
|
105 | + $hook->registerProperty($name, $property); |
|
106 | + } |
|
97 | 107 | return $hook; |
98 | 108 | } |
99 | 109 | } |