@@ -39,6 +39,10 @@ discard block |
||
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
42 | + /** |
|
43 | + * @param \DOMNode $element |
|
44 | + * @param integer $count |
|
45 | + */ |
|
42 | 46 | private function tagElement($element, $count) { |
43 | 47 | if ($count > 0) $element->setAttribute('transphporm', 'added'); |
44 | 48 | } |
@@ -46,6 +50,9 @@ discard block |
||
46 | 50 | return isset($values[1]) ? $values[1][0] : PHP_INT_MAX; |
47 | 51 | } |
48 | 52 | |
53 | + /** |
|
54 | + * @param \Transphporm\Hook\PseudoMatcher $pseudoMatcher |
|
55 | + */ |
|
49 | 56 | private function createHook($newRules, $pseudoMatcher, $properties) { |
50 | 57 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet)); |
51 | 58 | foreach ($properties as $name => $property) $hook->registerProperty($name, $property); |
@@ -15,7 +15,9 @@ 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 | |
20 | 22 | $max = $this->getMax($values); |
21 | 23 | $count = 0; |
@@ -23,7 +25,9 @@ discard block |
||
23 | 25 | $clone = $element->cloneNode(true); |
24 | 26 | //Mark all but one of the nodes as having been added by transphporm, when the hook is run again, these are removed |
25 | 27 | $this->tagElement($clone, $count++); |
26 | - if ($count > $max) break; |
|
28 | + if ($count > $max) { |
|
29 | + break; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | $this->elementData->bind($clone, $iteration, 'iteration'); |
29 | 33 | $this->elementData->bind($clone, $key, 'key'); |
@@ -40,7 +44,9 @@ discard block |
||
40 | 44 | } |
41 | 45 | |
42 | 46 | private function tagElement($element, $count) { |
43 | - if ($count > 0) $element->setAttribute('transphporm', 'added'); |
|
47 | + if ($count > 0) { |
|
48 | + $element->setAttribute('transphporm', 'added'); |
|
49 | + } |
|
44 | 50 | } |
45 | 51 | private function getMax($values) { |
46 | 52 | return isset($values[1]) ? $values[1][0] : PHP_INT_MAX; |
@@ -48,7 +54,9 @@ discard block |
||
48 | 54 | |
49 | 55 | private function createHook($newRules, $pseudoMatcher, $properties) { |
50 | 56 | $hook = new \Transphporm\Hook\PropertyHook($newRules, $pseudoMatcher, new \Transphporm\Parser\Value($this->functionSet)); |
51 | - foreach ($properties as $name => $property) $hook->registerProperty($name, $property); |
|
57 | + foreach ($properties as $name => $property) { |
|
58 | + $hook->registerProperty($name, $property); |
|
59 | + } |
|
52 | 60 | return $hook; |
53 | 61 | } |
54 | 62 | } |
55 | 63 | \ No newline at end of file |