@@ -42,9 +42,9 @@ discard block |
||
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); |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | |
101 | 101 | //Load a template, firstly check if it's a file or a valid string |
102 | 102 | private function loadTemplate() { |
103 | - $result = ['cache' => $this->template, 'headers' => []]; |
|
103 | + $result = ['cache' => $this->template, 'headers' => []]; |
|
104 | 104 | if (strpos($this->template, "\n") === false && is_file($this->template)) $result = $this->loadTemplateFromFile($this->template); |
105 | 105 | return $result; |
106 | 106 | } |
107 | 107 | |
108 | - private function loadTemplateFromFile($file) { |
|
109 | - $xml = $this->cache->load($this->cacheKey . $file, filemtime($file)); |
|
110 | - return $xml ? $xml : ['cache' => file_get_contents($file) ?: "", 'headers' => []]; |
|
111 | - } |
|
108 | + private function loadTemplateFromFile($file) { |
|
109 | + $xml = $this->cache->load($this->cacheKey . $file, filemtime($file)); |
|
110 | + return $xml ? $xml : ['cache' => file_get_contents($file) ?: "", 'headers' => []]; |
|
111 | + } |
|
112 | 112 | |
113 | 113 | public function setCache(\ArrayAccess $cache) { |
114 | 114 | $this->cache = new Cache($cache); |
@@ -7,17 +7,17 @@ |
||
7 | 7 | namespace Transphporm\SheetLoader; |
8 | 8 | //Separates out TSS file loading/caching from parsing |
9 | 9 | class SheetLoader { |
10 | - private $tss; |
|
11 | - private $filePath; |
|
12 | - private $time; |
|
13 | - private $import = []; |
|
14 | - |
|
15 | - public function __construct(\Transphporm\Cache $cache, \Transphporm\FilePath $filePath, TSSRules $tss, $time) { |
|
16 | - $this->cache = $cache; |
|
17 | - $this->filePath = $filePath; |
|
18 | - $this->tss = $tss; |
|
19 | - $this->time = isset($time) ? $time : time(); |
|
20 | - } |
|
10 | + private $tss; |
|
11 | + private $filePath; |
|
12 | + private $time; |
|
13 | + private $import = []; |
|
14 | + |
|
15 | + public function __construct(\Transphporm\Cache $cache, \Transphporm\FilePath $filePath, TSSRules $tss, $time) { |
|
16 | + $this->cache = $cache; |
|
17 | + $this->filePath = $filePath; |
|
18 | + $this->tss = $tss; |
|
19 | + $this->time = isset($time) ? $time : time(); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | //Allows controlling whether any updates are required to the template |
23 | 23 | //e.g. return false |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | $this->fileName = $fileName; |
18 | 18 | $this->filePath = $filePath; |
19 | 19 | $this->cache = $cache; |
20 | - $this->time = isset($time) ? $time : time(); |
|
21 | - $this->cacheName = $this->fileName; |
|
20 | + $this->time = isset($time) ? $time : time(); |
|
21 | + $this->cacheName = $this->fileName; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | private function getRulesFromCache($file) { |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | //write the sheet to cache |
80 | - public function write($rules, $imports = []) { |
|
80 | + public function write($rules, $imports = []) { |
|
81 | 81 | $existing = $this->cache->load($this->fileName, filemtime($this->fileName)); |
82 | 82 | if (isset($existing['import']) && empty($imports)) $imports = $existing['import']; |
83 | 83 | $this->cache->write($this->cacheName, ['rules' => $rules, 'import' => $imports, 'minFreq' => $this->getMinUpdateFreq($rules), 'ctime' => $this->time, 'cacheKey' => $this->cacheKey]); |
84 | 84 | |
85 | 85 | return $rules; |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - //Gets the minimum update-frequency for a sheet's rules |
|
88 | + //Gets the minimum update-frequency for a sheet's rules |
|
89 | 89 | private function getMinUpdateFreq($rules) { |
90 | 90 | $min = \PHP_INT_MAX; |
91 | 91 |