1 | <?php declare(strict_types=1); |
||
20 | abstract class Base implements Minifier |
||
21 | { |
||
22 | /** |
||
23 | * This contains the source code to be minfied. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $source; |
||
28 | |||
29 | /** |
||
30 | * We represent the source file that needs to be minified. |
||
31 | * |
||
32 | * @var SplFileInfo |
||
33 | */ |
||
34 | protected $file; |
||
35 | |||
36 | public function __construct(SplFileInfo $file, string $source) |
||
41 | |||
42 | public function minify(): string |
||
53 | |||
54 | /** |
||
55 | * This must be defined in any child classes. |
||
56 | * |
||
57 | * @return string The minfied source code. |
||
58 | */ |
||
59 | abstract protected function mini(): string; |
||
60 | |||
61 | /** |
||
62 | * If we can find a pre-minified version of the file lets use that, |
||
63 | * no point doing more work than we have to. Plus the vendor supplied |
||
64 | * minified versions will probably be better optimised. |
||
65 | * |
||
66 | * @return string|bool Either preminified source code or false. |
||
67 | */ |
||
68 | private function lookForPreMinifiedAsset() |
||
80 | } |
||
81 |