@@ -27,7 +27,9 @@ discard block |
||
27 | 27 | $this->cache = new Cache(new \ArrayObject()); |
28 | 28 | $this->filePath = new FilePath(); |
29 | 29 | $modules = is_array($modules) ? $modules : $this->defaultModules; |
30 | - foreach ($modules as $module) $this->loadModule(new $module); |
|
30 | + foreach ($modules as $module) { |
|
31 | + $this->loadModule(new $module); |
|
32 | + } |
|
31 | 33 | } |
32 | 34 | |
33 | 35 | //Allow setting the time used by Transphporm for caching. This is for testing purposes |
@@ -56,7 +58,9 @@ discard block |
||
56 | 58 | $valueParser = new Parser\Value($functionSet); |
57 | 59 | $this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5($this->tss)), $this->filePath, $headers); |
58 | 60 | |
59 | - foreach ($this->modules as $module) $module->load($this->config); |
|
61 | + foreach ($this->modules as $module) { |
|
62 | + $module->load($this->config); |
|
63 | + } |
|
60 | 64 | |
61 | 65 | $this->processRules($template, $this->config); |
62 | 66 | |
@@ -70,7 +74,9 @@ discard block |
||
70 | 74 | $rules = $this->getRules($template, $config); |
71 | 75 | |
72 | 76 | foreach ($rules as $rule) { |
73 | - if ($rule->shouldRun($this->time)) $this->executeTssRule($rule, $template, $config); |
|
77 | + if ($rule->shouldRun($this->time)) { |
|
78 | + $this->executeTssRule($rule, $template, $config); |
|
79 | + } |
|
74 | 80 | } |
75 | 81 | } |
76 | 82 | |
@@ -95,8 +101,9 @@ discard block |
||
95 | 101 | if (trim($this->template)[0] !== '<' && file_exists($this->template)) { |
96 | 102 | $xml = $this->cache->load($this->template, filemtime($this->template)); |
97 | 103 | return $xml ? $xml : ['body' => file_get_contents($this->template) ?: "", 'headers' => []]; |
104 | + } else { |
|
105 | + return ['body' => $this->template, 'headers' => []]; |
|
98 | 106 | } |
99 | - else return ['body' => $this->template, 'headers' => []]; |
|
100 | 107 | } |
101 | 108 | |
102 | 109 | //Load the TSS rules either from a file or as a string |
@@ -116,6 +123,8 @@ discard block |
||
116 | 123 | |
117 | 124 | public function __destruct() { |
118 | 125 | //Required hack as DomXPath can only register static functions clear, the statically stored instance to avoid memory leaks |
119 | - if (isset($this->config)) $this->config->getCssToXpath()->cleanup(); |
|
126 | + if (isset($this->config)) { |
|
127 | + $this->config->getCssToXpath()->cleanup(); |
|
128 | + } |
|
120 | 129 | } |
121 | 130 | } |