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