@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | public function setLocale($locale) { |
44 | - $format = new \Transphporm\Module\Format($locale); |
|
45 | - $this->modules[get_class($format)] = $format; |
|
46 | - } |
|
44 | + $format = new \Transphporm\Module\Format($locale); |
|
45 | + $this->modules[get_class($format)] = $format; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | public function addPath($dir) { |
49 | 49 | $this->filePath->addPath($dir); |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | //Load a template, firstly check if it's a file or a valid string |
95 | 95 | private function loadTemplate() { |
96 | - $result = ['cache' => $this->template, 'headers' => []]; |
|
96 | + $result = ['cache' => $this->template, 'headers' => []]; |
|
97 | 97 | if (strpos($this->template, "\n") === false && is_file($this->template)) $result = $this->loadTemplateFromFile($this->template); |
98 | 98 | return $result; |
99 | 99 | } |
100 | 100 | |
101 | - private function loadTemplateFromFile($file) { |
|
102 | - $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
103 | - return $xml ? $xml : ['cache' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
104 | - } |
|
101 | + private function loadTemplateFromFile($file) { |
|
102 | + $xml = $this->cache->load($this->template, filemtime($this->template)); |
|
103 | + return $xml ? $xml : ['cache' => file_get_contents($this->template) ?: "", 'headers' => []]; |
|
104 | + } |
|
105 | 105 | |
106 | 106 | public function setCache(\ArrayAccess $cache) { |
107 | 107 | $this->cache = new Cache($cache); |
@@ -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 | //The cache for the key: the filename and template prefix |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $file . dirname(realpath($file)) . DIRECTORY_SEPARATOR; |
50 | 50 | } |
51 | 51 | //write the sheet to cache |
52 | - public function write($file, $rules, $imports = []) { |
|
52 | + public function write($file, $rules, $imports = []) { |
|
53 | 53 | if (is_file($file)) { |
54 | 54 | $key = $this->getCacheKey($file); |
55 | 55 | $existing = $this->cache->load($key, filemtime($file)); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $this->cache->write($key, ['rules' => $rules, 'import' => $imports]); |
58 | 58 | } |
59 | 59 | return $rules; |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | 62 | public function processRules($template, \Transphporm\Config $config) { |
63 | 63 | $rules = $this->getRules($this->tss, $config->getCssToXpath(), $config->getValueParser()); |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | //Load the TSS |
75 | 75 | public function getRules($tss, $cssToXpath, $valueParser) { |
76 | 76 | if (is_file($tss)) { |
77 | - //$rules = $this->cache->load($tss); |
|
78 | - $rules = $this->getRulesFromCache($tss)['rules']; |
|
77 | + //$rules = $this->cache->load($tss); |
|
78 | + $rules = $this->getRulesFromCache($tss)['rules']; |
|
79 | 79 | $this->filePath->addPath(dirname(realpath($tss))); |
80 | 80 | if (empty($rules)) $tss = file_get_contents($tss); |
81 | 81 | else return $rules; |
82 | - } |
|
82 | + } |
|
83 | 83 | return (new Parser\Sheet($tss, $cssToXpath, $valueParser, $this->filePath, $this))->parse(); |
84 | 84 | } |
85 | 85 |