Completed
Push — master ( 73e1e5...4f3b07 )
by Tom
02:36
created
src/Builder.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,7 +25,9 @@  discard block
 block discarded – undo
25 25
 		$this->cache = new Cache(new \ArrayObject());
26 26
 
27 27
 		$modules = is_array($modules) ? $modules : $this->defaultModules;
28
-		foreach ($modules as $module) $this->loadModule(new $module);
28
+		foreach ($modules as $module) {
29
+			$this->loadModule(new $module);
30
+		}
29 31
 	}
30 32
 
31 33
 	//Allow setting the time used by Transphporm for caching. This is for testing purposes
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 		$data = new Hook\DataFunction(new \SplObjectStorage(), $data, $this->baseDir);
45 47
 		$featureSet = new FeatureSet($data, new Hook\Formatter(), $headers);
46 48
 
47
-		foreach ($this->modules as $module) $module->load($featureSet);
49
+		foreach ($this->modules as $module) {
50
+			$module->load($featureSet);
51
+		}
48 52
 		//$locale = $this->getLocale();
49 53
 		
50 54
 		$cachedOutput = $this->loadTemplate();
@@ -63,7 +67,9 @@  discard block
 block discarded – undo
63 67
 	private function processRules($template, $data, $featureSet) {
64 68
 		$valueParser = new Parser\Value($data);
65 69
 		foreach ($this->getRules($template, $valueParser) as $rule) {
66
-			if ($rule->shouldRun($this->time)) $this->executeTssRule($rule, $template, $valueParser, $featureSet);
70
+			if ($rule->shouldRun($this->time)) {
71
+				$this->executeTssRule($rule, $template, $valueParser, $featureSet);
72
+			}
67 73
 		}
68 74
 	}
69 75
 
@@ -90,8 +96,9 @@  discard block
 block discarded – undo
90 96
 		if (trim($this->template)[0] !== '<') {			
91 97
 			$xml = $this->cache->load($this->template, filemtime($this->template));
92 98
 			return $xml ? $xml : ['body' => file_get_contents($this->template), 'headers' => []];
99
+		} else {
100
+			return ['body' => $this->template, 'headers' => []];
93 101
 		}
94
-		else return ['body' => $this->template, 'headers' => []];	
95 102
 	}
96 103
 
97 104
 	//Load the TSS rules either from a file or as a string
@@ -105,10 +112,14 @@  discard block
 block discarded – undo
105 112
 			$key = $this->tss . $template->getPrefix() . $this->baseDir;
106 113
 			//Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet
107 114
 			$rules = $this->cache->load($key, filemtime($this->tss));
108
-			if (!$rules) return $this->cache->write($key, (new Parser\Sheet(file_get_contents($this->tss), $this->baseDir, $valueParser, $template->getPrefix()))->parse());
109
-			else return $rules;
115
+			if (!$rules) {
116
+				return $this->cache->write($key, (new Parser\Sheet(file_get_contents($this->tss), $this->baseDir, $valueParser, $template->getPrefix()))->parse());
117
+			} else {
118
+				return $rules;
119
+			}
120
+		} else {
121
+			return (new Parser\Sheet($this->tss, $this->baseDir, $valueParser, $template->getPrefix()))->parse();
110 122
 		}
111
-		else return (new Parser\Sheet($this->tss, $this->baseDir, $valueParser, $template->getPrefix()))->parse();
112 123
 	}
113 124
 
114 125
 	public function setCache(\ArrayAccess $cache) {
Please login to merge, or discard this patch.
src/FeatureSet.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,12 +35,16 @@
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	public function loadProperties(Hook\PropertyHook $hook) {
38
-		foreach ($this->properties as $name => $property) $hook->registerProperty($name, $property);
38
+		foreach ($this->properties as $name => $property) {
39
+			$hook->registerProperty($name, $property);
40
+		}
39 41
 	}
40 42
 
41 43
 	public function createPseudoMatcher($pseudo) {
42 44
 		$pseudoMatcher = new Hook\PseudoMatcher($pseudo);
43
-		foreach ($this->pseudo as $pseudoFunction) $pseudoMatcher->registerFunction($pseudoFunction);
45
+		foreach ($this->pseudo as $pseudoFunction) {
46
+			$pseudoMatcher->registerFunction($pseudoFunction);
47
+		}
44 48
 		return $pseudoMatcher;
45 49
 	}
46 50
 }
47 51
\ No newline at end of file
Please login to merge, or discard this patch.
src/Module/Format.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,9 +13,13 @@
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	private function getLocale() {
16
-		if (is_array($this->locale)) return $this->locale;
17
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../' . $this->locale . '.json'), true);
18
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
16
+		if (is_array($this->locale)) {
17
+			return $this->locale;
18
+		} else if (strlen($this->locale) > 0) {
19
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../' . $this->locale . '.json'), true);
20
+		} else {
21
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '../Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
22
+		}
19 23
 	}
20 24
 
21 25
 	public function load(\Transphporm\FeatureSet $featureSet) {
Please login to merge, or discard this patch.