@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | return $this->data->$func(...$args); |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param Value $parser |
|
39 | + */ |
|
37 | 40 | public function parseNested($parser, $token, $funcName) { |
38 | 41 | $args = $parser->parseTokens($token['value'], $this->data); |
39 | 42 | if ($args[0] == $this->data) $args = []; |
@@ -49,6 +52,9 @@ discard block |
||
49 | 52 | else return call_user_func_array([$obj, $func], $args); |
50 | 53 | } |
51 | 54 | |
55 | + /** |
|
56 | + * @param boolean $autoLookup |
|
57 | + */ |
|
52 | 58 | public function extract($last, $autoLookup) { |
53 | 59 | if ($autoLookup && isset($this->data->{$last})) { |
54 | 60 | return $this->data->{$last}; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | public function extract($last, $autoLookup) { |
53 | 53 | $value = $this->read($last); |
54 | - if ($value && ($autoLookup || is_array($this->data)) ) { |
|
54 | + if ($value && ($autoLookup || is_array($this->data))) { |
|
55 | 55 | return $value; |
56 | 56 | } |
57 | 57 | throw new \UnexpectedValueException('Not found'); |
@@ -14,16 +14,23 @@ discard block |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function traverse($key) { |
17 | - if (isset($this->data->{$key})) $this->data = $this->data->{$key}; |
|
18 | - else if (is_array($this->data) && isset($this->data[$key])) $this->data = $this->data[$key]; |
|
17 | + if (isset($this->data->{$key})) { |
|
18 | + $this->data = $this->data->{$key}; |
|
19 | + } else if (is_array($this->data) && isset($this->data[$key])) { |
|
20 | + $this->data = $this->data[$key]; |
|
21 | + } |
|
19 | 22 | } |
20 | 23 | |
21 | 24 | public function read($value) { |
22 | 25 | if (is_array($this->data)) { |
23 | - if (isset($this->data[$value])) return $this->data[$value]; |
|
26 | + if (isset($this->data[$value])) { |
|
27 | + return $this->data[$value]; |
|
28 | + } |
|
29 | + } else if (isset($this->data->$value)) { |
|
30 | + return $this->data->$value; |
|
31 | + } else { |
|
32 | + return false; |
|
24 | 33 | } |
25 | - else if (isset($this->data->$value)) return $this->data->$value; |
|
26 | - else return false; |
|
27 | 34 | } |
28 | 35 | |
29 | 36 | public function isFunctionSet() { |
@@ -36,7 +43,9 @@ discard block |
||
36 | 43 | |
37 | 44 | public function parseNested($parser, $token, $funcName) { |
38 | 45 | $args = $parser->parseTokens($token['value'], $this->data); |
39 | - if ($args[0] == $this->data) $args = []; |
|
46 | + if ($args[0] == $this->data) { |
|
47 | + $args = []; |
|
48 | + } |
|
40 | 49 | return $this->callFunc($funcName, $args, $this->data); |
41 | 50 | } |
42 | 51 | |
@@ -45,8 +54,11 @@ discard block |
||
45 | 54 | } |
46 | 55 | |
47 | 56 | private function callFuncOnObject($obj, $func, $args) { |
48 | - if (isset($obj->$func) && is_callable($obj->$func)) return call_user_func_array($obj->$func, $args); |
|
49 | - else return call_user_func_array([$obj, $func], $args); |
|
57 | + if (isset($obj->$func) && is_callable($obj->$func)) { |
|
58 | + return call_user_func_array($obj->$func, $args); |
|
59 | + } else { |
|
60 | + return call_user_func_array([$obj, $func], $args); |
|
61 | + } |
|
50 | 62 | } |
51 | 63 | |
52 | 64 | public function extract($last, $autoLookup) { |
@@ -15,14 +15,18 @@ 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 | |
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 |
||
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 |
||
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 | } |
@@ -13,7 +13,9 @@ |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | public function match($pseudo, \DomElement $element) { |
16 | - if (strpos($pseudo, '[') === false) return true; |
|
16 | + if (strpos($pseudo, '[') === false) { |
|
17 | + return true; |
|
18 | + } |
|
17 | 19 | |
18 | 20 | $this->functionSet->setElement($element); |
19 | 21 | $valueParser = new \Transphporm\Parser\Value($this->functionSet); |
@@ -31,7 +31,9 @@ |
||
31 | 31 | |
32 | 32 | public function hasFunction($name) { |
33 | 33 | foreach ($this->pseudo as $pseudo) { |
34 | - if (strpos($pseudo, $name) === 0) return true; |
|
34 | + if (strpos($pseudo, $name) === 0) { |
|
35 | + return true; |
|
36 | + } |
|
35 | 37 | } |
36 | 38 | } |
37 | 39 |
@@ -14,14 +14,18 @@ |
||
14 | 14 | } |
15 | 15 | |
16 | 16 | public function format($value, $rules) { |
17 | - if (!isset($rules['format'])) return $value; |
|
17 | + if (!isset($rules['format'])) { |
|
18 | + return $value; |
|
19 | + } |
|
18 | 20 | |
19 | 21 | $tokenizer = new \Transphporm\Parser\Tokenizer($rules['format']); |
20 | 22 | $tokens = $tokenizer->getTokens(); |
21 | 23 | |
22 | 24 | $functionName = $tokens[0]['value']; |
23 | 25 | $options = []; |
24 | - for ($i = 1; $i < count($tokens); $i++) $options[] = $tokens[$i]['value']; |
|
26 | + for ($i = 1; $i < count($tokens); $i++) { |
|
27 | + $options[] = $tokens[$i]['value']; |
|
28 | + } |
|
25 | 29 | |
26 | 30 | return $this->processFormat($options, $functionName, $value); |
27 | 31 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | $this->functionSet = $functionSet; |
21 | 21 | |
22 | 22 | $this->translators = [ |
23 | - ' ' => function($string) use ($prefix) { return '//' . $prefix . $string; }, |
|
24 | - '' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
25 | - '>' => function($string) use ($prefix) { return '/' . $prefix . $string; }, |
|
26 | - '#' => function($string) { return '[@id=\'' . $string . '\']'; }, |
|
27 | - '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' ' . $string . ' \')]'; }, |
|
28 | - '[' => function($string) use ($hash) { return '[' .'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \'' . $string . '\', ., "' . $hash . '")' . ']'; }, |
|
23 | + ' ' => function($string) use ($prefix) { return '//'.$prefix.$string; }, |
|
24 | + '' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
25 | + '>' => function($string) use ($prefix) { return '/'.$prefix.$string; }, |
|
26 | + '#' => function($string) { return '[@id=\''.$string.'\']'; }, |
|
27 | + '.' => function($string) { return '[contains(concat(\' \', normalize-space(@class), \' \'), \' '.$string.' \')]'; }, |
|
28 | + '[' => function($string) use ($hash) { return '['.'php:function(\'\Transphporm\Parser\CssToXpath::processAttr\', \''.$string.'\', ., "'.$hash.'")'.']'; }, |
|
29 | 29 | ']' => function() { return ''; } |
30 | 30 | ]; |
31 | 31 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | public function getXpath($css) { |
88 | - $this->css = str_replace([' >', '> '],['>', '>'], trim($css)); |
|
88 | + $this->css = str_replace([' >', '> '], ['>', '>'], trim($css)); |
|
89 | 89 | $css = explode(':', $this->css)[0]; |
90 | 90 | $selectors = $this->split($css); |
91 | 91 | $xpath = '/'; |
@@ -63,8 +63,11 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | private static function compare($comparator, $a, $b) { |
66 | - if ($comparator == '=') return $a == $b; |
|
67 | - else if ($comparator == '!=') return $a != $b; |
|
66 | + if ($comparator == '=') { |
|
67 | + return $a == $b; |
|
68 | + } else if ($comparator == '!=') { |
|
69 | + return $a != $b; |
|
70 | + } |
|
68 | 71 | } |
69 | 72 | |
70 | 73 | //split the css into indivudal functions |
@@ -78,8 +81,9 @@ discard block |
||
78 | 81 | $selector = $this->createSelector(); |
79 | 82 | $selector->type = $css[$i]; |
80 | 83 | $selectors[] = $selector; |
84 | + } else { |
|
85 | + $selector->string .= $css[$i]; |
|
81 | 86 | } |
82 | - else $selector->string .= $css[$i]; |
|
83 | 87 | } |
84 | 88 | return $selectors; |
85 | 89 | } |
@@ -90,7 +94,9 @@ discard block |
||
90 | 94 | $selectors = $this->split($css); |
91 | 95 | $xpath = '/'; |
92 | 96 | foreach ($selectors as $selector) { |
93 | - if (isset($this->translators[$selector->type])) $xpath .= $this->translators[$selector->type]($selector->string, $xpath); |
|
97 | + if (isset($this->translators[$selector->type])) { |
|
98 | + $xpath .= $this->translators[$selector->type]($selector->string, $xpath); |
|
99 | + } |
|
94 | 100 | } |
95 | 101 | |
96 | 102 | $xpath = str_replace('/[', '/*[', $xpath); |
@@ -50,7 +50,9 @@ discard block |
||
50 | 50 | $this->data = new ValueData($data); |
51 | 51 | $this->last = null; |
52 | 52 | |
53 | - if (empty($tokens)) return [$data]; |
|
53 | + if (empty($tokens)) { |
|
54 | + return [$data]; |
|
55 | + } |
|
54 | 56 | |
55 | 57 | foreach ($tokens as $token) { |
56 | 58 | $this->{$this->tokenFuncs[$token['type']]}($token); |
@@ -65,8 +67,7 @@ discard block |
||
65 | 67 | |
66 | 68 | if ($this->result->getMode() == Tokenizer::NOT && $token['type'] == Tokenizer::EQUALS) { |
67 | 69 | $this->result->setMode(Tokenizer::NOT); |
68 | - } |
|
69 | - else { |
|
70 | + } else { |
|
70 | 71 | $this->result->setMode($token['type']); |
71 | 72 | $this->last = null; |
72 | 73 | } |
@@ -75,13 +76,15 @@ discard block |
||
75 | 76 | //Reads the last selected value from $data regardless if it's an array or object and overrides $this->data with the new value |
76 | 77 | //Dot moves $data to the next object in $data foo.bar moves the $data pointer from `foo` to `bar` |
77 | 78 | private function processDot($token) { |
78 | - if ($this->last !== null) $this->data->traverse($this->last); |
|
79 | - else { |
|
79 | + if ($this->last !== null) { |
|
80 | + $this->data->traverse($this->last); |
|
81 | + } else { |
|
80 | 82 | //When . is not preceeded by anything, treat it as part of the string instead of an operator |
81 | 83 | // foo.bar is treated as looking up `bar` in `foo` whereas .foo is treated as the string ".foo" |
82 | 84 | $lastResult = $this->result->pop(); |
83 | - if ($lastResult) $this->data = new ValueData($lastResult); |
|
84 | - else { |
|
85 | + if ($lastResult) { |
|
86 | + $this->data = new ValueData($lastResult); |
|
87 | + } else { |
|
85 | 88 | $this->processString(['value' => '.']); |
86 | 89 | $this->result->setMode(Tokenizer::CONCAT); |
87 | 90 | } |
@@ -94,9 +97,10 @@ discard block |
||
94 | 97 | $parser = new Value($this->baseData, $this->autoLookup); |
95 | 98 | if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) { |
96 | 99 | $this->callTransphpormFunctions($token); |
97 | - } |
|
98 | - else { |
|
99 | - if ($this->last !== null) $this->data->traverse($this->last); |
|
100 | + } else { |
|
101 | + if ($this->last !== null) { |
|
102 | + $this->data->traverse($this->last); |
|
103 | + } |
|
100 | 104 | $this->last = $parser->parseTokens($token['value'], null)[0]; |
101 | 105 | } |
102 | 106 | } |
@@ -118,8 +122,7 @@ discard block |
||
118 | 122 | private function processBrackets($token) { |
119 | 123 | if ($this->baseData instanceof \Transphporm\Functionset && $this->baseData->hasFunction($this->last)) { |
120 | 124 | $this->callTransphpormFunctions($token); |
121 | - } |
|
122 | - else { |
|
125 | + } else { |
|
123 | 126 | $this->processNested($token); |
124 | 127 | } |
125 | 128 | } |
@@ -136,7 +139,9 @@ discard block |
||
136 | 139 | foreach ($this->result->getResult() as $i => $value) { |
137 | 140 | if (is_scalar($value)) { |
138 | 141 | $val = $this->data->read($value); |
139 | - if ($val) $this->result[$i] = $val; |
|
142 | + if ($val) { |
|
143 | + $this->result[$i] = $val; |
|
144 | + } |
|
140 | 145 | } |
141 | 146 | } |
142 | 147 | $this->last = null; |
@@ -148,12 +153,10 @@ discard block |
||
148 | 153 | try { |
149 | 154 | $value = $this->data->extract($this->last, $this->autoLookup); |
150 | 155 | $this->result->processValue($value); |
151 | - } |
|
152 | - catch (\UnexpectedValueException $e) { |
|
156 | + } catch (\UnexpectedValueException $e) { |
|
153 | 157 | if (!$this->autoLookup) { |
154 | 158 | $this->result->processValue($this->last); |
155 | - } |
|
156 | - else { |
|
159 | + } else { |
|
157 | 160 | $this->result->clear(); |
158 | 161 | $this->result[0] = false; |
159 | 162 | } |
@@ -1,27 +1,27 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Transphporm\TSSFunction; |
3 | 3 | class Json implements \Transphporm\TSSFunction { |
4 | - private $baseDir; |
|
4 | + private $baseDir; |
|
5 | 5 | |
6 | - public function __construct(&$baseDir) { |
|
7 | - $this->baseDir = &$baseDir; |
|
8 | - } |
|
6 | + public function __construct(&$baseDir) { |
|
7 | + $this->baseDir = &$baseDir; |
|
8 | + } |
|
9 | 9 | |
10 | - public function run(array $args, \DomElement $element = null) { |
|
11 | - $json = $args[0]; |
|
10 | + public function run(array $args, \DomElement $element = null) { |
|
11 | + $json = $args[0]; |
|
12 | 12 | |
13 | - if (trim($json)[0] != '{') { |
|
14 | - if (is_file($this->baseDir . $args[0])) $jsonFile = $this->baseDir . $json; |
|
15 | - elseif (is_file($args[0])) $jsonFile = $json; |
|
16 | - else throw new \Exception('JSON File "' . $json .'" does not exist'); |
|
13 | + if (trim($json)[0] != '{') { |
|
14 | + if (is_file($this->baseDir . $args[0])) $jsonFile = $this->baseDir . $json; |
|
15 | + elseif (is_file($args[0])) $jsonFile = $json; |
|
16 | + else throw new \Exception('JSON File "' . $json .'" does not exist'); |
|
17 | 17 | |
18 | - $json = file_get_contents($jsonFile); |
|
19 | - } |
|
18 | + $json = file_get_contents($jsonFile); |
|
19 | + } |
|
20 | 20 | |
21 | - $map = json_decode($json, true); |
|
21 | + $map = json_decode($json, true); |
|
22 | 22 | |
23 | - if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
23 | + if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
24 | 24 | |
25 | - return $map; |
|
26 | - } |
|
25 | + return $map; |
|
26 | + } |
|
27 | 27 | } |
@@ -11,16 +11,16 @@ |
||
11 | 11 | $json = $args[0]; |
12 | 12 | |
13 | 13 | if (trim($json)[0] != '{') { |
14 | - if (is_file($this->baseDir . $args[0])) $jsonFile = $this->baseDir . $json; |
|
14 | + if (is_file($this->baseDir.$args[0])) $jsonFile = $this->baseDir.$json; |
|
15 | 15 | elseif (is_file($args[0])) $jsonFile = $json; |
16 | - else throw new \Exception('JSON File "' . $json .'" does not exist'); |
|
16 | + else throw new \Exception('JSON File "'.$json.'" does not exist'); |
|
17 | 17 | |
18 | 18 | $json = file_get_contents($jsonFile); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $map = json_decode($json, true); |
22 | 22 | |
23 | - if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
23 | + if (!is_array($map)) throw new \Exception('Could not decode json: '.json_last_error_msg()); |
|
24 | 24 | |
25 | 25 | return $map; |
26 | 26 | } |
@@ -11,16 +11,22 @@ |
||
11 | 11 | $json = $args[0]; |
12 | 12 | |
13 | 13 | if (trim($json)[0] != '{') { |
14 | - if (is_file($this->baseDir . $args[0])) $jsonFile = $this->baseDir . $json; |
|
15 | - elseif (is_file($args[0])) $jsonFile = $json; |
|
16 | - else throw new \Exception('JSON File "' . $json .'" does not exist'); |
|
14 | + if (is_file($this->baseDir . $args[0])) { |
|
15 | + $jsonFile = $this->baseDir . $json; |
|
16 | + } elseif (is_file($args[0])) { |
|
17 | + $jsonFile = $json; |
|
18 | + } else { |
|
19 | + throw new \Exception('JSON File "' . $json .'" does not exist'); |
|
20 | + } |
|
17 | 21 | |
18 | 22 | $json = file_get_contents($jsonFile); |
19 | 23 | } |
20 | 24 | |
21 | 25 | $map = json_decode($json, true); |
22 | 26 | |
23 | - if (!is_array($map)) throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
27 | + if (!is_array($map)) { |
|
28 | + throw new \Exception('Could not decode json: ' . json_last_error_msg()); |
|
29 | + } |
|
24 | 30 | |
25 | 31 | return $map; |
26 | 32 | } |
@@ -27,14 +27,14 @@ |
||
27 | 27 | $selector = $this->readArray($args, 1); |
28 | 28 | $tss = $this->readArray($args, 2); |
29 | 29 | |
30 | - if (is_file($this->baseDir . $args[0])) $xmlFile = $this->baseDir . $args[0]; |
|
30 | + if (is_file($this->baseDir.$args[0])) $xmlFile = $this->baseDir.$args[0]; |
|
31 | 31 | elseif (is_file($args[0])) $xmlFile = $args[0]; |
32 | - else throw new \Exception('XML File "' . $args[0] .'" does not exist'); |
|
32 | + else throw new \Exception('XML File "'.$args[0].'" does not exist'); |
|
33 | 33 | |
34 | 34 | if ($tss) { |
35 | - if (is_file($this->baseDir . $tss)) $tssFile = $this->baseDir . $tss; |
|
35 | + if (is_file($this->baseDir.$tss)) $tssFile = $this->baseDir.$tss; |
|
36 | 36 | elseif (is_file($args[0])) $tssFile = $tss; |
37 | - else throw new \Exception('TSS File "' . $tss .'" does not exist'); |
|
37 | + else throw new \Exception('TSS File "'.$tss.'" does not exist'); |
|
38 | 38 | } |
39 | 39 | else $tssFile = null; |
40 | 40 |
@@ -27,21 +27,32 @@ discard block |
||
27 | 27 | $selector = $this->readArray($args, 1); |
28 | 28 | $tss = $this->readArray($args, 2); |
29 | 29 | |
30 | - if (is_file($this->baseDir . $args[0])) $xmlFile = $this->baseDir . $args[0]; |
|
31 | - elseif (is_file($args[0])) $xmlFile = $args[0]; |
|
32 | - else throw new \Exception('XML File "' . $args[0] .'" does not exist'); |
|
30 | + if (is_file($this->baseDir . $args[0])) { |
|
31 | + $xmlFile = $this->baseDir . $args[0]; |
|
32 | + } elseif (is_file($args[0])) { |
|
33 | + $xmlFile = $args[0]; |
|
34 | + } else { |
|
35 | + throw new \Exception('XML File "' . $args[0] .'" does not exist'); |
|
36 | + } |
|
33 | 37 | |
34 | 38 | if ($tss) { |
35 | - if (is_file($this->baseDir . $tss)) $tssFile = $this->baseDir . $tss; |
|
36 | - elseif (is_file($args[0])) $tssFile = $tss; |
|
37 | - else throw new \Exception('TSS File "' . $tss .'" does not exist'); |
|
39 | + if (is_file($this->baseDir . $tss)) { |
|
40 | + $tssFile = $this->baseDir . $tss; |
|
41 | + } elseif (is_file($args[0])) { |
|
42 | + $tssFile = $tss; |
|
43 | + } else { |
|
44 | + throw new \Exception('TSS File "' . $tss .'" does not exist'); |
|
45 | + } |
|
46 | + } else { |
|
47 | + $tssFile = null; |
|
38 | 48 | } |
39 | - else $tssFile = null; |
|
40 | 49 | |
41 | 50 | $newTemplate = new \Transphporm\Builder($xmlFile, $tssFile); |
42 | 51 | |
43 | 52 | $doc = $newTemplate->output($this->elementData->getData($element), true)->body; |
44 | - if ($selector != '') return $this->templateSubsection($doc, $selector); |
|
53 | + if ($selector != '') { |
|
54 | + return $this->templateSubsection($doc, $selector); |
|
55 | + } |
|
45 | 56 | |
46 | 57 | return $this->getTemplateContent($doc, $tss); |
47 | 58 | |
@@ -71,7 +82,9 @@ discard block |
||
71 | 82 | |
72 | 83 | private function getClonedElement($node, $tss) { |
73 | 84 | $clone = $node->cloneNode(true); |
74 | - if ($tss != null && $clone instanceof \DomElement) $clone->setAttribute('transphporm', 'includedtemplate'); |
|
85 | + if ($tss != null && $clone instanceof \DomElement) { |
|
86 | + $clone->setAttribute('transphporm', 'includedtemplate'); |
|
87 | + } |
|
75 | 88 | return $clone; |
76 | 89 | } |
77 | 90 | } |