FluentDOM\Loader\Json\JsonML::transferToElement PHP Method

transferToElement() private method

private transferToElement ( DOMNode $node, $json )
$node DOMNode
$json
    private function transferToElement(\DOMNode $node, $json)
    {
        $dom = $node instanceof \DOMDocument ? $node : $node->ownerDocument;
        $nodeName = $json[0];
        $length = count($json);
        $hasProperties = $length > 1 && is_object($json[1]);
        $properties = $hasProperties ? $json[1] : new \stdClass();
        $namespace = $this->getNamespaceForNode($nodeName, $properties, $node);
        $element = empty($namespace) ? $dom->createElement($nodeName) : $dom->createElementNS($namespace, $nodeName);
        $node->appendChild($element);
        $this->addNamespaceAttributes($element, $properties);
        $this->addAttributes($element, $properties);
        $childOffset = $hasProperties ? 2 : 1;
        for ($i = $childOffset; $i < $length; $i++) {
            $this->transferTo($element, $json[$i]);
        }
    }