FluentDOM\Serializer\Json\RabbitFish::getNodesArray PHP Méthode

getNodesArray() private méthode

private getNodesArray ( DOMElement $node, stdClass | array $attributes, Xpath $xpath ) : array
$node DOMElement
$attributes stdClass | array
$xpath FluentDOM\Xpath
Résultat array
    private function getNodesArray(\DOMElement $node, $attributes, $xpath)
    {
        $result = [];
        foreach ($attributes as $name => $value) {
            $child = new \stdClass();
            $child->{$name} = $value;
            $result[] = $child;
        }
        foreach ($xpath->evaluate('*|text()[normalize-space(.) != ""]', $node) as $childNode) {
            /** @var \DOMElement|\DOMText|\DOMCdataSection $childNode */
            if ($childNode instanceof \DOMElement) {
                $child = new \stdClass();
                $child->{$childNode->nodeName} = $this->getNodes($childNode);
                $result[] = $child;
            } elseif (!$childNode->isWhitespaceInElementContent()) {
                $result[] = $childNode->nodeValue;
            }
        }
        return $result;
    }