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