@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | * @version 1.2 */ |
7 | 7 | namespace Transphporm; |
8 | 8 | class TSSCache { |
9 | - private $cache; |
|
10 | - private $prefix; |
|
9 | + private $cache; |
|
10 | + private $prefix; |
|
11 | 11 | |
12 | - public function __construct(Cache $cache, $prefix) { |
|
13 | - $this->cache = $cache; |
|
14 | - $this->prefix = $prefix; |
|
15 | - } |
|
12 | + public function __construct(Cache $cache, $prefix) { |
|
13 | + $this->cache = $cache; |
|
14 | + $this->prefix = $prefix; |
|
15 | + } |
|
16 | 16 | |
17 | 17 | private function getRulesFromCache($file) { |
18 | 18 | //The cache for the key: the filename and template prefix |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | return $file . $this->prefix . dirname(realpath($file)) . DIRECTORY_SEPARATOR; |
34 | 34 | } |
35 | 35 | |
36 | - public function load($tss) { |
|
37 | - return $this->getRulesFromCache($tss); |
|
38 | - } |
|
36 | + public function load($tss) { |
|
37 | + return $this->getRulesFromCache($tss); |
|
38 | + } |
|
39 | 39 | |
40 | - public function write($file, $rules, $imports = []) { |
|
41 | - if (is_file($file)) { |
|
42 | - $key = $this->getCacheKey($file); |
|
43 | - $existing = $this->cache->load($key, filemtime($file)); |
|
44 | - if (isset($existing['import']) && empty($imports)) $imports = $existing['import']; |
|
45 | - $this->cache->write($key, ['rules' => $rules, 'import' => $imports]); |
|
46 | - } |
|
47 | - return $rules; |
|
48 | - } |
|
40 | + public function write($file, $rules, $imports = []) { |
|
41 | + if (is_file($file)) { |
|
42 | + $key = $this->getCacheKey($file); |
|
43 | + $existing = $this->cache->load($key, filemtime($file)); |
|
44 | + if (isset($existing['import']) && empty($imports)) $imports = $existing['import']; |
|
45 | + $this->cache->write($key, ['rules' => $rules, 'import' => $imports]); |
|
46 | + } |
|
47 | + return $rules; |
|
48 | + } |
|
49 | 49 | } |