Skip to content

Commit a31bfdb

Browse files
committed
IHF: format_xml helper added.
1 parent 26fa07a commit a31bfdb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/format.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ function format_bytes($bytes, $precision = 2)
3838
}
3939
}
4040

41+
if (!function_exists('format_xml')) {
42+
function format_xml($xml)
43+
{
44+
$dom = new DOMDocument();
45+
46+
$dom->loadXML($xml);
47+
$dom->formatOutput = true;
48+
$dom->preserveWhiteSpace = false;
49+
50+
return $dom->saveXml();
51+
}
52+
}
53+
4154
if (!function_exists('backtrace_as_string')) {
4255
function backtrace_as_string()
4356
{

0 commit comments

Comments
 (0)