diff --git a/.gitignore b/.gitignore index 227cca8..43975bd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ vendor/ composer.lock package-lock.json + +playground.php diff --git a/src/Services/ConvertToXml.php b/src/Services/ConvertToXml.php index d16a2f2..ae72923 100644 --- a/src/Services/ConvertToXml.php +++ b/src/Services/ConvertToXml.php @@ -19,11 +19,14 @@ class ConvertToXml { + protected DOMDocument $document; + public function __construct( #[Config('feeds.pretty')] bool $pretty, - protected DOMDocument $document ) { + $this->document = new DOMDocument('1.0', 'UTF-8'); + $this->document->formatOutput = $pretty; $this->document->preserveWhiteSpace = ! $pretty; }