1 | <?php |
||
14 | class MinifyHtmlExtension extends AbstractExtension |
||
15 | { |
||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | private $options = [ |
||
20 | 'is_safe' => ['html'], |
||
21 | 'needs_environment' => true, |
||
22 | ]; |
||
23 | |||
24 | /** |
||
25 | * @var callable |
||
26 | */ |
||
27 | private $callable; |
||
28 | |||
29 | /** |
||
30 | * @var HtmlMin |
||
31 | */ |
||
32 | private $minifier; |
||
33 | |||
34 | /** |
||
35 | * @var bool |
||
36 | */ |
||
37 | private $forceCompression = false; |
||
38 | |||
39 | /** |
||
40 | * MinifyHtmlExtension constructor. |
||
41 | * |
||
42 | * @param HtmlMin $htmlMin |
||
43 | * @param bool $forceCompression Default: false. Forces compression regardless of Twig's debug setting. |
||
44 | */ |
||
45 | 9 | public function __construct(HtmlMin $htmlMin, bool $forceCompression = false) |
|
51 | |||
52 | /** |
||
53 | * @param Environment $twig |
||
54 | * @param string $html |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | 9 | public function compress(Environment $twig, $html) |
|
86 | |||
87 | /** @noinspection PhpMissingParentCallCommonInspection */ |
||
88 | |||
89 | /** |
||
90 | * @return array |
||
91 | */ |
||
92 | 6 | public function getFilters(): array |
|
98 | |||
99 | /** @noinspection PhpMissingParentCallCommonInspection */ |
||
100 | 6 | public function getFunctions(): array |
|
106 | |||
107 | /** @noinspection PhpMissingParentCallCommonInspection */ |
||
108 | 6 | public function getTokenParsers(): array |
|
114 | |||
115 | /** |
||
116 | * @param Environment $twig |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | 9 | public function isCompressionActive(Environment $twig): bool |
|
126 | } |
||
127 |