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