@@ -7,6 +7,9 @@ |
||
| 7 | 7 | $this->templateFunction = $templateFunction; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param string $val |
|
| 12 | + */ |
|
| 10 | 13 | public function html($val) { |
| 11 | 14 | return $this->templateFunction->run([$val]); |
| 12 | 15 | } |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Transphporm\Formatter; |
| 3 | 3 | class HTMLFormatter { |
| 4 | - private $templateFunction; |
|
| 4 | + private $templateFunction; |
|
| 5 | 5 | |
| 6 | - public function __construct(\Transphporm\TSSFunction\Template $templateFunction) { |
|
| 7 | - $this->templateFunction = $templateFunction; |
|
| 8 | - } |
|
| 6 | + public function __construct(\Transphporm\TSSFunction\Template $templateFunction) { |
|
| 7 | + $this->templateFunction = $templateFunction; |
|
| 8 | + } |
|
| 9 | 9 | |
| 10 | - public function html($val) { |
|
| 10 | + public function html($val) { |
|
| 11 | 11 | return $this->templateFunction->run([$val]); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -14,6 +14,6 @@ |
||
| 14 | 14 | public function debug($val) { |
| 15 | 15 | ob_start(); |
| 16 | 16 | var_dump($val); |
| 17 | - return $this->html('<pre>' . ob_get_clean() . '</pre>'); |
|
| 17 | + return $this->html('<pre>'.ob_get_clean().'</pre>'); |
|
| 18 | 18 | } |
| 19 | 19 | } |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | $tss = $this->readArray($args, 2); |
| 27 | 27 | |
| 28 | 28 | if (trim($args[0])[0] === '<') $xml = $args[0]; |
| 29 | - else $xml = $this->baseDir . $args[0]; |
|
| 29 | + else $xml = $this->baseDir.$args[0]; |
|
| 30 | 30 | |
| 31 | - $newTemplate = new \Transphporm\Builder($xml, $tss ? $this->baseDir . $tss : null); |
|
| 31 | + $newTemplate = new \Transphporm\Builder($xml, $tss ? $this->baseDir.$tss : null); |
|
| 32 | 32 | |
| 33 | 33 | $doc = $newTemplate->output($this->elementData->getData($element), true)->body; |
| 34 | 34 | if ($selector != '') return $this->templateSubsection($doc, $selector); |
@@ -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->baseDir . $args[0]; |
|
| 28 | + if (trim($args[0])[0] === '<') { |
|
| 29 | + $xml = $args[0]; |
|
| 30 | + } else { |
|
| 31 | + $xml = $this->baseDir . $args[0]; |
|
| 32 | + } |
|
| 30 | 33 | |
| 31 | 34 | $newTemplate = new \Transphporm\Builder($xml, $tss ? $this->baseDir . $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, $tss); |
| 37 | 42 | |
@@ -62,7 +67,9 @@ discard block |
||
| 62 | 67 | |
| 63 | 68 | private function getClonedElement($node, $tss) { |
| 64 | 69 | $clone = $node->cloneNode(true); |
| 65 | - if ($tss != null && $clone instanceof \DomElement) $clone->setAttribute('transphporm', 'includedtemplate'); |
|
| 70 | + if ($tss != null && $clone instanceof \DomElement) { |
|
| 71 | + $clone->setAttribute('transphporm', 'includedtemplate'); |
|
| 72 | + } |
|
| 66 | 73 | return $clone; |
| 67 | 74 | } |
| 68 | 75 | } |