@@ -15,7 +15,9 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function run($value, \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 | |
| 20 | 22 | $rule = $rules['repeat']; |
| 21 | 23 | |
@@ -26,8 +28,12 @@ discard block |
||
| 26 | 28 | foreach ($value as $key => $iteration) { |
| 27 | 29 | $clone = $element->cloneNode(true); |
| 28 | 30 | //Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed |
| 29 | - if ($count++ > 0) $clone->setAttribute('transphporm', 'added'); |
|
| 30 | - if ($count > $max) break; |
|
| 31 | + if ($count++ > 0) { |
|
| 32 | + $clone->setAttribute('transphporm', 'added'); |
|
| 33 | + } |
|
| 34 | + if ($count > $max) { |
|
| 35 | + break; |
|
| 36 | + } |
|
| 31 | 37 | |
| 32 | 38 | $this->elementData->bind($clone, $iteration, 'iteration'); |
| 33 | 39 | $this->elementData->bind($clone, $key, 'key'); |
@@ -45,7 +51,9 @@ discard block |
||
| 45 | 51 | |
| 46 | 52 | private function createHook($newRules, $pseudoMatcher, $properties) { |
| 47 | 53 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet)); |
| 48 | - foreach ($properties as $name => $property) $hook->registerProperty($name, $property); |
|
| 54 | + foreach ($properties as $name => $property) { |
|
| 55 | + $hook->registerProperty($name, $property); |
|
| 56 | + } |
|
| 49 | 57 | return $hook; |
| 50 | 58 | } |
| 51 | 59 | } |
| 52 | 60 | \ No newline at end of file |