FluentDOM\Loader\Json\JsonDOM::transferObjectTo PHP Méthode

transferObjectTo() private méthode

The method creates child nodes for each property. The property name will be normalized to a valid NCName. If the normalized NCName is different from the property name or verbose is TRUE, a json:name attribute with the property name will be added.
private transferObjectTo ( DOMNode $target, object $value, integer $recursions )
$target DOMNode
$value object
$recursions integer
    private function transferObjectTo(\DOMNode $target, $value, $recursions)
    {
        $properties = is_array($value) ? $value : get_object_vars($value);
        if ($this->_verbose || empty($properties)) {
            $target->setAttributeNS(self::XMLNS, 'json:type', 'object');
        }
        foreach ($properties as $property => $item) {
            $qname = $this->getQualifiedName($property, self::DEFAULT_QNAME);
            $target->appendChild($child = $target->ownerDocument->createElement($qname));
            if ($this->_verbose || $qname != $property) {
                $child->setAttributeNS(self::XMLNS, 'json:name', $property);
            }
            $this->transferTo($child, $item, $recursions);
        }
    }