protected function transferTo(\DOMNode $node, $json)
{
/** @var Document $dom */
$dom = $node->ownerDocument ?: $node;
if ($json instanceof \stdClass) {
foreach ($json as $name => $data) {
if ($name == '@attributes') {
if ($data instanceof \stdClass) {
foreach ($data as $attributeName => $attributeValue) {
$node->setAttribute($attributeName, $this->getValueAsString($attributeValue));
}
}
} else {
$this->transferChildTo($node, $name, $data);
}
}
} elseif (is_scalar($json)) {
$node->appendChild($dom->createTextNode($this->getValueAsString($json)));
}
}