@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setLocale($locale) { |
44 | - $format = new \Transphporm\Module\Format($locale); |
|
45 | - $this->modules[get_class($format)] = $format; |
|
46 | - } |
|
44 | + $format = new \Transphporm\Module\Format($locale); |
|
45 | + $this->modules[get_class($format)] = $format; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | public function addPath($dir) { |
49 | 49 | $this->filePath->addPath($dir); |
@@ -97,15 +97,15 @@ discard block |
||
97 | 97 | |
98 | 98 | //Load a template, firstly check if it's a file or a valid string |
99 | 99 | private function loadTemplate() { |
100 | - $result = ['body' => $this->template, 'headers' => []]; |
|
100 | + $result = ['body' => $this->template, 'headers' => []]; |
|
101 | 101 | if (strpos($this->template, "\n") === false && is_file($this->template)) $result = $this->loadTemplateFromFile($this->template); |
102 | 102 | return $result; |
103 | 103 | } |
104 | 104 | |
105 | - private function loadTemplateFromFile($file) { |
|
106 | - $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
107 | - return $xml ? $xml : ['body' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
108 | - } |
|
105 | + private function loadTemplateFromFile($file) { |
|
106 | + $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
107 | + return $xml ? $xml : ['body' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
108 | + } |
|
109 | 109 | |
110 | 110 | //Load the TSS rules either from a file or as a string |
111 | 111 | //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 |
@@ -61,7 +63,9 @@ discard block |
||
61 | 63 | $valueParser = new Parser\Value($functionSet); |
62 | 64 | $this->config = new Config($functionSet, $valueParser, $elementData, new Hook\Formatter(), new Parser\CssToXpath($functionSet, $template->getPrefix(), md5($this->tss)), $this->filePath, $headers); |
63 | 65 | |
64 | - foreach ($this->modules as $module) $module->load($this->config); |
|
66 | + foreach ($this->modules as $module) { |
|
67 | + $module->load($this->config); |
|
68 | + } |
|
65 | 69 | |
66 | 70 | $this->processRules($template, $this->config); |
67 | 71 | |
@@ -75,7 +79,9 @@ discard block |
||
75 | 79 | $rules = $this->getRules($template, $config); |
76 | 80 | |
77 | 81 | foreach ($rules as $rule) { |
78 | - if ($rule->shouldRun($this->time)) $this->executeTssRule($rule, $template, $config); |
|
82 | + if ($rule->shouldRun($this->time)) { |
|
83 | + $this->executeTssRule($rule, $template, $config); |
|
84 | + } |
|
79 | 85 | } |
80 | 86 | } |
81 | 87 | |
@@ -98,7 +104,9 @@ discard block |
||
98 | 104 | //Load a template, firstly check if it's a file or a valid string |
99 | 105 | private function loadTemplate() { |
100 | 106 | $result = ['body' => $this->template, 'headers' => []]; |
101 | - if (strpos($this->template, "\n") === false && is_file($this->template)) $result = $this->loadTemplateFromFile($this->template); |
|
107 | + if (strpos($this->template, "\n") === false && is_file($this->template)) { |
|
108 | + $result = $this->loadTemplateFromFile($this->template); |
|
109 | + } |
|
102 | 110 | return $result; |
103 | 111 | } |
104 | 112 | |
@@ -124,6 +132,8 @@ discard block |
||
124 | 132 | |
125 | 133 | public function __destruct() { |
126 | 134 | //Required hack as DomXPath can only register static functions clear the statically stored instance to avoid memory leaks |
127 | - if (isset($this->config)) $this->config->getCssToXpath()->cleanup(); |
|
135 | + if (isset($this->config)) { |
|
136 | + $this->config->getCssToXpath()->cleanup(); |
|
137 | + } |
|
128 | 138 | } |
129 | 139 | } |