1 | <?php |
||
19 | class Processor |
||
20 | { |
||
21 | const FORMATTER_COMPRESSED = 'compressed'; |
||
22 | const FORMATTER_CRUNCHED = 'crunched'; |
||
23 | const FORMATTER_EXPANDED = 'expanded'; |
||
24 | const FORMATTER_NESTED = 'nested'; |
||
25 | const FORMATTER_COMPACT = 'compact'; |
||
26 | public static $supportedFormatters = [ |
||
27 | self::FORMATTER_COMPRESSED, |
||
28 | self::FORMATTER_CRUNCHED, |
||
29 | self::FORMATTER_EXPANDED, |
||
30 | self::FORMATTER_NESTED, |
||
31 | self::FORMATTER_COMPACT |
||
32 | ]; |
||
33 | /** |
||
34 | * @var IOInterface |
||
35 | */ |
||
36 | private $io; |
||
37 | /** |
||
38 | * @var FileContainer[] |
||
39 | */ |
||
40 | private $files = []; |
||
41 | /** |
||
42 | * @var SCSSCompiler |
||
43 | */ |
||
44 | private $scss; |
||
45 | /** |
||
46 | * @var LESSCompiler |
||
47 | */ |
||
48 | private $less; |
||
49 | |||
50 | 17 | public function __construct(IOInterface $io) |
|
58 | |||
59 | /** |
||
60 | * @param string $inputPath |
||
61 | * @param string $outputPath |
||
62 | * |
||
63 | * @throws \Exception |
||
64 | */ |
||
65 | 8 | public function attachFiles($inputPath, $outputPath) |
|
80 | |||
81 | /** |
||
82 | * @return FileContainer[] |
||
83 | */ |
||
84 | 5 | public function getFiles() |
|
88 | |||
89 | /** |
||
90 | * @return string[] |
||
91 | */ |
||
92 | 2 | protected function concatOutput() |
|
105 | |||
106 | /** |
||
107 | * save output into file |
||
108 | */ |
||
109 | 2 | public function saveOutput() |
|
122 | |||
123 | /** |
||
124 | * @param string $formatter |
||
125 | * |
||
126 | * @throws CompilerException |
||
127 | */ |
||
128 | 6 | public function processFiles($formatter) |
|
144 | |||
145 | /** |
||
146 | * @param FileContainer $file |
||
147 | * |
||
148 | * @return FileContainer |
||
149 | * @throws CompilerException |
||
150 | */ |
||
151 | 11 | public function processFile(FileContainer $file) |
|
162 | |||
163 | /** |
||
164 | * @param FileContainer $file |
||
165 | * |
||
166 | * @return $this |
||
167 | * @throws CompilerException |
||
168 | */ |
||
169 | 6 | protected function compileSCSS(FileContainer $file) |
|
180 | |||
181 | /** |
||
182 | * @param FileContainer $file |
||
183 | * |
||
184 | * @return $this |
||
185 | * @throws CompilerException |
||
186 | */ |
||
187 | 4 | protected function compileLESS(FileContainer $file) |
|
195 | |||
196 | /** |
||
197 | * @param string $formatter |
||
198 | * |
||
199 | * @return string |
||
200 | */ |
||
201 | 8 | protected function getFormatterClass($formatter) |
|
209 | |||
210 | /** |
||
211 | * @param FileContainer $file |
||
212 | * |
||
213 | * @throws FileException |
||
214 | */ |
||
215 | 8 | protected function fetchInputContextIntoFile(FileContainer $file) |
|
223 | } |
||
224 |