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