Skip to content

Commit

Permalink
feat: make XmlDocument stringable
Browse files Browse the repository at this point in the history
(cherry picked from commit 4073afa)
  • Loading branch information
wazelin committed Nov 15, 2022
1 parent 70bb5fe commit 40a7e4f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion qtism/data/storage/xml/XmlDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,19 @@ public function __construct($version = '2.1', QtiComponent $documentComponent =

public function __serialize(): array
{
return ['domDocument' => $this->saveToString(false)];
return ['domDocument' => (string)$this];
}

public function __unserialize(array $data): void
{
$this->loadFromString($data['domDocument']);
}

public function __toString(): string
{
return $this->saveToString(false);
}

/**
* Set the DOMDocument object in use.
*
Expand Down

0 comments on commit 40a7e4f

Please sign in to comment.