Total Complexity | 1 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class HtmlMinifier |
||
9 | { |
||
10 | private $replace = [ |
||
11 | '/<!--[\s\S]*?-->/' => '', //remove comments |
||
12 | "/<\?php/" => '<?php ', |
||
13 | "/\n([\S])/" => '$1', |
||
14 | "/\r/" => '', // remove carriage return |
||
15 | "/\n/" => '', // remove new lines |
||
16 | "/\t/" => '', // remove tab |
||
17 | "/\s+/" => ' ', // remove spaces |
||
18 | ]; |
||
19 | |||
20 | /** |
||
21 | * @param $htmlString string |
||
22 | * @return string |
||
23 | */ |
||
24 | 9 | public function minify(string $htmlString): string |
|
29 |