@@ -25,13 +25,18 @@ discard block |
||
| 25 | 25 | $selector = $this->readArray($args, 1); |
| 26 | 26 | $tss = $this->readArray($args, 2); |
| 27 | 27 | |
| 28 | - if (trim($args[0])[0] === '<') $xml = $args[0]; |
|
| 29 | - else $xml = $this->filePath->getFilePath($args[0]); |
|
| 28 | + if (trim($args[0])[0] === '<') { |
|
| 29 | + $xml = $args[0]; |
|
| 30 | + } else { |
|
| 31 | + $xml = $this->filePath->getFilePath($args[0]); |
|
| 32 | + } |
|
| 30 | 33 | |
| 31 | 34 | $newTemplate = new \Transphporm\Builder($xml, $tss ? $this->filePath->getFilePath($tss) : null); |
| 32 | 35 | |
| 33 | 36 | $doc = $newTemplate->output($this->elementData->getData($element), true)->body; |
| 34 | - if ($selector != '') return $this->templateSubsection($doc, $selector); |
|
| 37 | + if ($selector != '') { |
|
| 38 | + return $this->templateSubsection($doc, $selector); |
|
| 39 | + } |
|
| 35 | 40 | |
| 36 | 41 | return $this->getTemplateContent($doc->documentElement, $tss); |
| 37 | 42 | |
@@ -41,8 +46,11 @@ discard block |
||
| 41 | 46 | $result = []; |
| 42 | 47 | if ($newNode->tagName === 'template') { |
| 43 | 48 | foreach ($newNode->childNodes as $node) { |
| 44 | - if (isset($node->tagName) && $node->tagName === 'template') $result[] = $this->getTemplateContent($node, $tss); |
|
| 45 | - else $result[] = $this->getClonedElement($node, $tss); |
|
| 49 | + if (isset($node->tagName) && $node->tagName === 'template') { |
|
| 50 | + $result[] = $this->getTemplateContent($node, $tss); |
|
| 51 | + } else { |
|
| 52 | + $result[] = $this->getClonedElement($node, $tss); |
|
| 53 | + } |
|
| 46 | 54 | } |
| 47 | 55 | } |
| 48 | 56 | return $result; |
@@ -62,7 +70,9 @@ discard block |
||
| 62 | 70 | |
| 63 | 71 | private function getClonedElement($node, $tss) { |
| 64 | 72 | $clone = $node->cloneNode(true); |
| 65 | - if ($tss != null && $clone instanceof \DomElement) $clone->setAttribute('transphporm', 'includedtemplate'); |
|
| 73 | + if ($tss != null && $clone instanceof \DomElement) { |
|
| 74 | + $clone->setAttribute('transphporm', 'includedtemplate'); |
|
| 75 | + } |
|
| 66 | 76 | return $clone; |
| 67 | 77 | } |
| 68 | 78 | } |