1 | <?php |
||
12 | class Processor |
||
13 | { |
||
14 | const FORMATTER_COMPRESSED = 'compressed'; |
||
15 | const FORMATTER_CRUNCHED = 'crunched'; |
||
16 | const FORMATTER_EXPANDED = 'expanded'; |
||
17 | const FORMATTER_NESTED = 'nested'; |
||
18 | const FORMATTER_COMPACT = 'compact'; |
||
19 | const SUPPORTED_FORMATTERS = [ |
||
20 | self::FORMATTER_COMPRESSED, |
||
21 | self::FORMATTER_CRUNCHED, |
||
22 | self::FORMATTER_EXPANDED, |
||
23 | self::FORMATTER_NESTED, |
||
24 | self::FORMATTER_COMPACT |
||
25 | ]; |
||
26 | /** |
||
27 | * @var IOInterface |
||
28 | */ |
||
29 | private $io; |
||
30 | /** |
||
31 | * @var File[] |
||
32 | */ |
||
33 | private $files = []; |
||
34 | /** |
||
35 | * @var SASSCompiler |
||
36 | */ |
||
37 | private $sass; |
||
38 | /** |
||
39 | * @var LESSCompiler |
||
40 | */ |
||
41 | private $less; |
||
42 | |||
43 | public function __construct(IOInterface $io) |
||
48 | |||
49 | protected function initCompilers() |
||
56 | |||
57 | /** |
||
58 | * @param string $inputPath |
||
59 | * @param string $outputPath |
||
60 | * |
||
61 | * @throws \Exception |
||
62 | */ |
||
63 | public function attachFiles($inputPath, $outputPath) |
||
78 | |||
79 | /** |
||
80 | * @return File[] |
||
81 | */ |
||
82 | public function getFiles() |
||
86 | |||
87 | /** |
||
88 | * @return string[] |
||
89 | */ |
||
90 | protected function concatOutput() |
||
103 | |||
104 | /** |
||
105 | * save output into file |
||
106 | */ |
||
107 | public function saveOutput() |
||
120 | |||
121 | /** |
||
122 | * @param string $formatter |
||
123 | * |
||
124 | * @throws CompilerException |
||
125 | */ |
||
126 | public function processFiles($formatter) |
||
142 | |||
143 | /** |
||
144 | * @param File $file |
||
145 | * |
||
146 | * @return File |
||
147 | * @throws CompilerException |
||
148 | */ |
||
149 | public function processFile(File $file) |
||
162 | |||
163 | /** |
||
164 | * @param string $formatter |
||
165 | * |
||
166 | * @return string |
||
167 | */ |
||
168 | protected function getFormatterClass($formatter) |
||
176 | } |
||
177 |