Completed
Push — master ( c42a51...da7c37 )
by Tom
01:57
created
src/Builder.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 
44 44
 	public function setLocale($locale) {
45
-        $format = new \Transphporm\Module\Format($locale);
46
-        $this->modules[get_class($format)] = $format;
47
-    }
45
+		$format = new \Transphporm\Module\Format($locale);
46
+		$this->modules[get_class($format)] = $format;
47
+	}
48 48
 
49 49
 	public function addPath($dir) {
50 50
 		$this->filePath->addPath($dir);
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
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 = ['cache' => $this->template, 'headers' => []];
100
+		$result = ['cache' => $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->cacheKey . $this->template, filemtime($this->template));
107
-        return $xml ? $xml : ['cache' => file_get_contents($this->template) ?: "", 'headers' => []];
108
-    }
105
+	private function loadTemplateFromFile($file) {
106
+		$xml = $this->cache->load($this->cacheKey . $this->template, filemtime($this->template));
107
+		return $xml ? $xml : ['cache' => file_get_contents($this->template) ?: "", 'headers' => []];
108
+	}
109 109
 
110 110
 	public function setCache(\ArrayAccess $cache) {
111 111
 		$this->cache = new Cache($cache);
Please login to merge, or discard this patch.
src/SheetLoader.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
 namespace Transphporm;
8 8
 //Separates out TSS file loading/caching from parsing
9 9
 class SheetLoader {
10
-    private $cache;
11
-    private $sheet;
12
-    private $time;
13
-    private $import = [];
14
-    private $cacheKey;
15
-    private $rules;
16
-    private $cacheName;
17
-
18
-    public function __construct(Cache $cache, FilePath $filePath, $tss, $time) {
19
-    	$this->cache = $cache;
20
-        $this->filePath = $filePath;
21
-        $this->tss = $tss;
22
-        $this->time = $time ?? time();
23
-        $this->cacheName = $tss;
24
-    }
10
+	private $cache;
11
+	private $sheet;
12
+	private $time;
13
+	private $import = [];
14
+	private $cacheKey;
15
+	private $rules;
16
+	private $cacheName;
17
+
18
+	public function __construct(Cache $cache, FilePath $filePath, $tss, $time) {
19
+		$this->cache = $cache;
20
+		$this->filePath = $filePath;
21
+		$this->tss = $tss;
22
+		$this->time = $time ?? time();
23
+		$this->cacheName = $tss;
24
+	}
25 25
 
26 26
 	private function getRulesFromCache($file) {
27 27
 		//Try to load the cached rules, if not set in the cache (or expired) parse the supplied sheet
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 	}
91 91
 
92 92
 	//write the sheet to cache
93
-    public function write($file, $rules, $imports = []) {
93
+	public function write($file, $rules, $imports = []) {
94 94
 		if (is_file($file)) {
95 95
 			$existing = $this->cache->load($file, filemtime($file));
96 96
 			if (isset($existing['import']) && empty($imports)) $imports = $existing['import'];
97 97
 			$this->cache->write($this->cacheName, ['rules' => $rules, 'import' => $imports, 'minFreq' => $this->getMinUpdateFreq($rules), 'ctime' => $this->time, 'cacheKey' => $this->cacheKey]);
98 98
 		}
99 99
 		return $rules;
100
-    }
100
+	}
101 101
 
102 102
 	public function processRules($template, \Transphporm\Config $config) {
103 103
 		$rules = $this->getRules($this->tss, $config->getCssToXpath(), $config->getValueParser());
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	//Load the TSS
114 114
 	public function getRules($tss, $cssToXpath, $valueParser) {
115 115
 		if (is_file($tss)) {
116
-    		//$rules = $this->cache->load($tss);
117
-    		$rules = $this->getRulesFromCache($tss)['rules'];
116
+			//$rules = $this->cache->load($tss);
117
+			$rules = $this->getRulesFromCache($tss)['rules'];
118 118
 			$this->filePath->addPath(dirname(realpath($tss)));
119 119
 			if (empty($rules)) $tss = file_get_contents($tss);
120 120
 			else return $rules;
121
-    	}
121
+		}
122 122
 		return $tss == null ? [] : (new Parser\Sheet($tss, $cssToXpath, $valueParser, $this->filePath, $this))->parse();
123 123
 	}
124 124
 	//Process a TSS rule e.g. `ul li {content: "foo"; format: bar}
Please login to merge, or discard this patch.