Total Complexity | 6 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
22 | class Html extends AbstractOptimize |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | public function getName(): string |
||
28 | { |
||
29 | return 'Optimizing HTML'; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function init(array $options): void |
||
36 | { |
||
37 | $this->type = 'html'; |
||
38 | parent::init($options); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function setProcessor(): void |
||
45 | { |
||
46 | $this->processor = new HtmlMin(); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function processFile(\Symfony\Component\Finder\SplFileInfo $file): string |
||
53 | { |
||
54 | $html = Util\File::fileGetContents($file->getPathname()); |
||
55 | |||
56 | return $this->processor->minify($html); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * {@inheritdoc} |
||
61 | */ |
||
62 | public function encode(string $content = null): ?string |
||
63 | { |
||
64 | return json_encode($content); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | public function decode(string $content = null): ?string |
||
73 | } |
||
74 | } |
||
75 |