Skip to content

Commit

Permalink
allow to pass dom doc as header
Browse files Browse the repository at this point in the history
  • Loading branch information
goetas committed Jan 30, 2021
1 parent 3cda88b commit 86592c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Headers/Handler/HeaderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ public function serializeHeaderPlaceholder(SerializationVisitorInterface $visito
public function serializeHeader(SerializationVisitorInterface $visitor, Header $header, array $type, SerializationContext $context): void
{
$data = $header->getData();
if ($data instanceof \DOMDocument) {
$data = $data->documentElement;
}

if ($data instanceof \DOMElement) {
$importedNode = $data->ownerDocument !== $visitor->getDocument()
? $visitor->getDocument()->importNode($data, true)
Expand Down

0 comments on commit 86592c7

Please sign in to comment.