public function dump(Template $template)
{
$metadata = $template->getMetadata();
$dom = $template->getDocument();
$dom->preserveWhiteSpace = true;
$dom->formatOutput = false;
if ($metadata['xmldeclaration']) {
return $dom->saveXML();
} else {
$xml = '';
foreach ($dom->childNodes as $node) {
$xml .= $dom->saveXML($node);
if ($node instanceof \DOMDocumentType) {
$xml .= PHP_EOL;
}
}
return $xml;
}
}