Completed
Push — master ( c7ecd9...ea3e1b )
by Richard
02:26
created
src/Builder.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.