Skip to content

Commit

Permalink
Adding XMLDataCache to ZugferdDocumentPdfBuilder (like ZugferdDocumen…
Browse files Browse the repository at this point in the history
…tPdfMerger)
  • Loading branch information
HorstOeko committed Aug 17, 2023
1 parent 772dd2b commit be26511
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/ZugferdDocumentPdfBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ class ZugferdDocumentPdfBuilder extends ZugferdDocumentAbstractPdfBuilder
*/
private $documentBuiler = null;

/**
* Cached XML data
*
* @var string
*/
private $xmlDataCache = "";

/**
* Constructor
*
Expand All @@ -52,7 +59,13 @@ public function __construct(ZugferdDocumentBuilder $documentBuiler, string $pdfD
*/
protected function getXmlContent(): string
{
return $this->documentBuiler->getContentAsDomDocument()->saveXML();
if ($this->xmlDataCache) {
return $this->xmlDataCache;
}

$this->xmlDataCache = $this->documentBuiler->getContentAsDomDocument()->saveXML();

return $this->xmlDataCache;
}

/**
Expand Down

0 comments on commit be26511

Please sign in to comment.