Add function minizeHTMLString()

This commit is contained in:
jrenslin authored and stefan committed 2020-10-21 21:16:18 +02:00
1 parent 087b4a128e
commit 711bd49048
1 file changed
+16
+16
View File
@@ -340,4 +340,20 @@ public static function openssl_random_pseudo_bytes(int $length):string {
} }
/**
* Function for minimizing HTML, trimming each line.
*
* @param string $input Input.
*
* @return string
*/
public static function minimizeHTMLString(string $input):string {
$input = \explode(PHP_EOL, $input);
$output = "";
foreach ($input as $line) $output .= \trim($line) . PHP_EOL;
return $output;
}
} }