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