1 | <?php |
||
16 | class Processor |
||
17 | { |
||
18 | const FORMATTER_COMPRESSED = 'compressed'; |
||
19 | const FORMATTER_CRUNCHED = 'crunched'; |
||
20 | const FORMATTER_EXPANDED = 'expanded'; |
||
21 | const FORMATTER_NESTED = 'nested'; |
||
22 | const FORMATTER_COMPACT = 'compact'; |
||
23 | static $supportedFormatters = [ |
||
|
|||
24 | self::FORMATTER_COMPRESSED, |
||
25 | self::FORMATTER_CRUNCHED, |
||
26 | self::FORMATTER_EXPANDED, |
||
27 | self::FORMATTER_NESTED, |
||
28 | self::FORMATTER_COMPACT |
||
29 | ]; |
||
30 | /** |
||
31 | * @var IOInterface |
||
32 | */ |
||
33 | private $io; |
||
34 | /** |
||
35 | * @var FileContainer[] |
||
36 | */ |
||
37 | private $files = []; |
||
38 | /** |
||
39 | * @var SASSCompiler |
||
40 | */ |
||
41 | private $sass; |
||
42 | /** |
||
43 | * @var LESSCompiler |
||
44 | */ |
||
45 | private $less; |
||
46 | |||
47 | public function __construct(IOInterface $io) |
||
48 | { |
||
49 | $this->io = $io; |
||
50 | $this->initCompilers(); |
||
51 | } |
||
52 | |||
53 | protected function initCompilers() |
||
54 | { |
||
55 | $this->less = new LESSCompiler(); |
||
56 | $this->sass = new SASSCompiler(); |
||
57 | /** attaches compass functionality to the SASS compiler */ |
||
58 | new CompassCompiler($this->sass); |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @param string $inputPath |
||
63 | * @param string $outputPath |
||
64 | * |
||
65 | * @throws \Exception |
||
66 | */ |
||
67 | public function attachFiles($inputPath, $outputPath) |
||
82 | |||
83 | /** |
||
84 | * @return FileContainer[] |
||
85 | */ |
||
86 | public function getFiles() |
||
90 | |||
91 | /** |
||
92 | * @return string[] |
||
93 | */ |
||
94 | protected function concatOutput() |
||
107 | |||
108 | /** |
||
109 | * save output into file |
||
110 | */ |
||
111 | public function saveOutput() |
||
124 | |||
125 | /** |
||
126 | * @param string $formatter |
||
127 | * |
||
128 | * @throws CompilerException |
||
129 | */ |
||
130 | public function processFiles($formatter) |
||
146 | |||
147 | /** |
||
148 | * @param FileContainer $file |
||
149 | * |
||
150 | * @return FileContainer |
||
151 | * @throws CompilerException |
||
152 | */ |
||
153 | public function processFile(FileContainer $file) |
||
167 | |||
168 | /** |
||
169 | * @param string $formatter |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | protected function getFormatterClass($formatter) |
||
181 | |||
182 | /** |
||
183 | * @param FileContainer $file |
||
184 | * |
||
185 | * @throws FileException |
||
186 | */ |
||
187 | protected function fetchInputContextIntoFile(FileContainer $file) |
||
195 | } |
||
196 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.