Completed
Push — master ( aa557b...9caa90 )
by Tom
02:59
created
src/Builder.php 1 patch
Braces   +22 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
52 52
 	private function processRules($template, $data) {
53 53
 		$valueParser = new ValueParser($data);
54 54
 		foreach ($this->getRules($template, $valueParser) as $rule) {
55
-			if ($rule->shouldRun($this->time)) $this->executeTssRule($rule, $template, $data, $valueParser);			
55
+			if ($rule->shouldRun($this->time)) {
56
+				$this->executeTssRule($rule, $template, $data, $valueParser);
57
+			}
56 58
 		}
57 59
 	}
58 60
 
@@ -66,7 +68,9 @@  discard block
 block discarded – undo
66 68
 	private function executeTssRule($rule, $template, $data, $valueParser) {
67 69
 		$rule->touch();
68 70
 		$hook = new Hook\Rule($rule->properties, new Hook\PseudoMatcher($rule->pseudo, $data), $valueParser);
69
-		foreach ($this->registeredProperties as $name => $property) $hook->registerProperty($name, $property);
71
+		foreach ($this->registeredProperties as $name => $property) {
72
+			$hook->registerProperty($name, $property);
73
+		}
70 74
 		$template->addHook($rule->query, $hook);
71 75
 	}
72 76
 
@@ -75,8 +79,9 @@  discard block
 block discarded – undo
75 79
 		if (trim($this->template)[0] !== '<') {			
76 80
 			$xml = $this->cache->load($this->template, filemtime($this->template));
77 81
 			return $xml ? $xml : ['body' => file_get_contents($this->template), 'headers' => []];
82
+		} else {
83
+			return ['body' => $this->template, 'headers' => []];
78 84
 		}
79
-		else return ['body' => $this->template, 'headers' => []];	
80 85
 	}
81 86
 
82 87
 	//Load the TSS rules either from a file or as a string
@@ -90,10 +95,14 @@  discard block
 block discarded – undo
90 95
 			$key = $this->tss . $template->getPrefix() . $this->baseDir;
91 96
 			//Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet
92 97
 			$rules = $this->cache->load($key, filemtime($this->tss));
93
-			if (!$rules) return $this->cache->write($key, (new Sheet(file_get_contents($this->tss), $this->baseDir, $valueParser, $template->getPrefix()))->parse());
94
-			else return $rules;
98
+			if (!$rules) {
99
+				return $this->cache->write($key, (new Sheet(file_get_contents($this->tss), $this->baseDir, $valueParser, $template->getPrefix()))->parse());
100
+			} else {
101
+				return $rules;
102
+			}
103
+		} else {
104
+			return (new Sheet($this->tss, $this->baseDir, $valueParser, $template->getPrefix()))->parse();
95 105
 		}
96
-		else return (new Sheet($this->tss, $this->baseDir, $valueParser, $template->getPrefix()))->parse();
97 106
 	}
98 107
 
99 108
 	public function setCache(\ArrayAccess $cache) {
@@ -101,9 +110,13 @@  discard block
 block discarded – undo
101 110
 	}
102 111
 
103 112
 	private function getLocale() {
104
-		if (is_array($this->locale)) return $this->locale;
105
-		else if (strlen($this->locale) > 0) return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
106
-		else return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
113
+		if (is_array($this->locale)) {
114
+			return $this->locale;
115
+		} else if (strlen($this->locale) > 0) {
116
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . $this->locale . '.json'), true);
117
+		} else {
118
+			return json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'Formatter' . DIRECTORY_SEPARATOR . 'Locale' . DIRECTORY_SEPARATOR . 'enGB.json'), true);
119
+		}
107 120
 	}
108 121
 
109 122
 	public function registerProperty($name, Property $property) {
Please login to merge, or discard this patch.