@@ -7,17 +7,17 @@ discard block |
||
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 | - |
|
15 | - public function __construct(Cache $cache, FilePath $filePath, $tss, $time) { |
|
16 | - $this->cache = $cache; |
|
17 | - $this->filePath = $filePath; |
|
18 | - $this->tss = $tss; |
|
19 | - $this->time = $time ?? time(); |
|
20 | - } |
|
10 | + private $cache; |
|
11 | + private $sheet; |
|
12 | + private $time; |
|
13 | + private $import = []; |
|
14 | + |
|
15 | + public function __construct(Cache $cache, FilePath $filePath, $tss, $time) { |
|
16 | + $this->cache = $cache; |
|
17 | + $this->filePath = $filePath; |
|
18 | + $this->tss = $tss; |
|
19 | + $this->time = $time ?? time(); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | private function getRulesFromCache($file) { |
23 | 23 | $key = $file; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | return dirname(realpath($file)); |
71 | 71 | } |
72 | 72 | //write the sheet to cache |
73 | - public function write($file, $rules, $imports = []) { |
|
73 | + public function write($file, $rules, $imports = []) { |
|
74 | 74 | |
75 | 75 | if (is_file($file)) { |
76 | 76 | $key = $this->getCacheKey($file); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->cache->write($file, ['rules' => $rules, 'import' => $imports, 'minFreq' => $this->getMinUpdateFreq($rules), 'ctime' => time()]); |
80 | 80 | } |
81 | 81 | return $rules; |
82 | - } |
|
82 | + } |
|
83 | 83 | |
84 | 84 | public function processRules($template, \Transphporm\Config $config) { |
85 | 85 | $rules = $this->getRules($this->tss, $config->getCssToXpath(), $config->getValueParser()); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | //Load the TSS |
97 | 97 | public function getRules($tss, $cssToXpath, $valueParser) { |
98 | 98 | if (is_file($tss)) { |
99 | - //$rules = $this->cache->load($tss); |
|
100 | - $rules = $this->getRulesFromCache($tss)['rules']; |
|
99 | + //$rules = $this->cache->load($tss); |
|
100 | + $rules = $this->getRulesFromCache($tss)['rules']; |
|
101 | 101 | $this->filePath->addPath(dirname(realpath($tss))); |
102 | 102 | if (empty($rules)) $tss = file_get_contents($tss); |
103 | 103 | else return $rules; |
104 | - } |
|
104 | + } |
|
105 | 105 | return $tss == null ? [] : (new Parser\Sheet($tss, $cssToXpath, $valueParser, $this->filePath, $this))->parse(); |
106 | 106 | } |
107 | 107 |