@@ -92,15 +92,15 @@ |
||
92 | 92 | |
93 | 93 | //Load a template, firstly check if it's a file or a valid string |
94 | 94 | private function loadTemplate() { |
95 | - $result = ['body' => $this->template, 'headers' => []]; |
|
95 | + $result = ['body' => $this->template, 'headers' => []]; |
|
96 | 96 | if (file_exists($this->template)) $result = $this->loadTemplateFromFile($this->template); |
97 | 97 | return $result; |
98 | 98 | } |
99 | 99 | |
100 | - private function loadTemplateFromFile($file) { |
|
101 | - $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
102 | - return $xml ? $xml : ['body' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
103 | - } |
|
100 | + private function loadTemplateFromFile($file) { |
|
101 | + $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
102 | + return $xml ? $xml : ['body' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
103 | + } |
|
104 | 104 | |
105 | 105 | //Load the TSS rules either from a file or as a string |
106 | 106 | //N.b. only files can be cached |
@@ -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 | |
@@ -93,7 +99,9 @@ discard block |
||
93 | 99 | //Load a template, firstly check if it's a file or a valid string |
94 | 100 | private function loadTemplate() { |
95 | 101 | $result = ['body' => $this->template, 'headers' => []]; |
96 | - if (file_exists($this->template)) $result = $this->loadTemplateFromFile($this->template); |
|
102 | + if (file_exists($this->template)) { |
|
103 | + $result = $this->loadTemplateFromFile($this->template); |
|
104 | + } |
|
97 | 105 | return $result; |
98 | 106 | } |
99 | 107 | |
@@ -119,6 +127,8 @@ discard block |
||
119 | 127 | |
120 | 128 | public function __destruct() { |
121 | 129 | //Required hack as DomXPath can only register static functions clear, the statically stored instance to avoid memory leaks |
122 | - if (isset($this->config)) $this->config->getCssToXpath()->cleanup(); |
|
130 | + if (isset($this->config)) { |
|
131 | + $this->config->getCssToXpath()->cleanup(); |
|
132 | + } |
|
123 | 133 | } |
124 | 134 | } |