Completed
Push — master ( 3e9dd6...32f022 )
by Tom
02:12
created
src/SheetLoader/TSSFile.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	public function updateRequired($data) {
47
-		$this->cacheName = $this->getCacheKey($data) . $this->fileName;
47
+		$this->cacheName = $this->getCacheKey($data).$this->fileName;
48 48
 
49 49
 		$rules = $this->getRulesFromCache($this->fileName);
50 50
 		//Nothing was cached or the TSS file has changed, update is required
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		if ($this->cacheKey) {
62 62
 			$parser = new \Transphporm\Parser\Value($data);
63 63
 			$cacheKey = $parser->parseTokens($this->cacheKey)[0];
64
-			$this->cacheName = $cacheKey . $this->fileName;
64
+			$this->cacheName = $cacheKey.$this->fileName;
65 65
 			return $cacheKey;
66 66
 		}
67 67
 		else return $this->fileName;
Please login to merge, or discard this patch.
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
32 32
 		if ($rules) {
33 33
 			foreach ($rules['import'] as $file) {
34 34
 				//Check that the import file hasn't been changed since the cache was written
35
-				if (filemtime($file) > $rules['ctime']) return false;
35
+				if (filemtime($file) > $rules['ctime']) {
36
+					return false;
37
+				}
36 38
 			}
37 39
 		}
38 40
 
@@ -48,10 +50,14 @@  discard block
 block discarded – undo
48 50
 
49 51
 		$rules = $this->getRulesFromCache($this->fileName);
50 52
 		//Nothing was cached or the TSS file has changed, update is required
51
-		if (empty($rules)) return true;
53
+		if (empty($rules)) {
54
+			return true;
55
+		}
52 56
 
53 57
 		//Find the sheet's minimum update-frequency, if it hasn't passed then no updates are required
54
-		if ($rules['ctime']+$rules['minFreq'] <= $this->time) return true;
58
+		if ($rules['ctime']+$rules['minFreq'] <= $this->time) {
59
+			return true;
60
+		}
55 61
 
56 62
 		return false;
57 63
 	}
@@ -63,15 +69,19 @@  discard block
 block discarded – undo
63 69
 			$cacheKey = $parser->parseTokens($this->cacheKey)[0];
64 70
 			$this->cacheName = $cacheKey . $this->fileName;
65 71
 			return $cacheKey;
72
+		} else {
73
+			return $this->fileName;
66 74
 		}
67
-		else return $this->fileName;
68 75
 	}
69 76
 
70 77
 	public function getRules($cssToXpath, $valueParser, $sheetLoader, $indexStart) {
71 78
 		$rules = $this->getRulesFromCache($this->fileName)['rules'];
72 79
 		$this->filePath->addPath(dirname(realpath($this->fileName)));
73
-		if (empty($rules)) $tss = file_get_contents($this->fileName);
74
-		else return $rules;
80
+		if (empty($rules)) {
81
+			$tss = file_get_contents($this->fileName);
82
+		} else {
83
+			return $rules;
84
+		}
75 85
 
76 86
 		return $tss == null ? [] : (new \Transphporm\Parser\Sheet($tss, $cssToXpath, $valueParser, $this->filePath, $sheetLoader))->parse($indexStart);
77 87
 	}
@@ -79,7 +89,9 @@  discard block
 block discarded – undo
79 89
 	//write the sheet to cache
80 90
     public function write($rules, $imports = []) {
81 91
 		$existing = $this->cache->load($this->fileName, filemtime($this->fileName));
82
-		if (isset($existing['import']) && empty($imports)) $imports = $existing['import'];
92
+		if (isset($existing['import']) && empty($imports)) {
93
+			$imports = $existing['import'];
94
+		}
83 95
 		$this->cache->write($this->cacheName, ['rules' => $rules, 'import' => $imports, 'minFreq' => $this->getMinUpdateFreq($rules), 'ctime' => $this->time, 'cacheKey' => $this->cacheKey]);
84 96
 
85 97
 		return $rules;
@@ -91,7 +103,9 @@  discard block
 block discarded – undo
91 103
 
92 104
 		foreach ($rules as $rule) {
93 105
 			$ruleFreq = $rule->getUpdateFrequency();
94
-			if ($ruleFreq < $min) $min = $ruleFreq;
106
+			if ($ruleFreq < $min) {
107
+				$min = $ruleFreq;
108
+			}
95 109
 		}
96 110
 
97 111
 		return $min;
Please login to merge, or discard this patch.