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 SASSCompiler |
||
43 | */ |
||
44 | private $sass; |
||
45 | /** |
||
46 | * @var LESSCompiler |
||
47 | */ |
||
48 | private $less; |
||
49 | |||
50 | public function __construct(IOInterface $io) |
||
55 | |||
56 | protected function initCompilers() |
||
63 | |||
64 | /** |
||
65 | * @param string $inputPath |
||
66 | * @param string $outputPath |
||
67 | * |
||
68 | * @throws \Exception |
||
69 | */ |
||
70 | public function attachFiles($inputPath, $outputPath) |
||
85 | |||
86 | /** |
||
87 | * @return FileContainer[] |
||
88 | */ |
||
89 | public function getFiles() |
||
93 | |||
94 | /** |
||
95 | * @return string[] |
||
96 | */ |
||
97 | protected function concatOutput() |
||
110 | |||
111 | /** |
||
112 | * save output into file |
||
113 | */ |
||
114 | public function saveOutput() |
||
127 | |||
128 | /** |
||
129 | * @param string $formatter |
||
130 | * |
||
131 | * @throws CompilerException |
||
132 | */ |
||
133 | public function processFiles($formatter) |
||
149 | |||
150 | /** |
||
151 | * @param FileContainer $file |
||
152 | * |
||
153 | * @return FileContainer |
||
154 | * @throws CompilerException |
||
155 | */ |
||
156 | public function processFile(FileContainer $file) |
||
167 | |||
168 | /** |
||
169 | * @param FileContainer $file |
||
170 | * |
||
171 | * @return $this |
||
172 | * @throws CompilerException |
||
173 | */ |
||
174 | protected function compileSCSS(FileContainer $file) |
||
185 | |||
186 | /** |
||
187 | * @param FileContainer $file |
||
188 | * |
||
189 | * @return $this |
||
190 | * @throws CompilerException |
||
191 | */ |
||
192 | protected function compileLESS(FileContainer $file) |
||
200 | |||
201 | /** |
||
202 | * @param string $formatter |
||
203 | * |
||
204 | * @return string |
||
205 | */ |
||
206 | protected function getFormatterClass($formatter) |
||
214 | |||
215 | /** |
||
216 | * @param FileContainer $file |
||
217 | * |
||
218 | * @throws FileException |
||
219 | */ |
||
220 | protected function fetchInputContextIntoFile(FileContainer $file) |
||
228 | } |
||
229 |