Neos\Flow\I18n\Cldr\CldrParser::parseNode PHP Method

parseNode() protected method

Please see the documentation of this class for details about the internal representation of XML data.
protected parseNode ( SimpleXMLElement $node ) : mixed
$node SimpleXMLElement A node to start parsing from
return mixed An array representing parsed XML node or string value if leaf
    protected function parseNode(\SimpleXMLElement $node)
    {
        $parsedNode = [];
        if ($node->count() === 0) {
            return (string) $node;
        }
        foreach ($node->children() as $child) {
            $nameOfChild = $child->getName();
            $parsedChild = $this->parseNode($child);
            if (count($child->attributes()) > 0) {
                $parsedAttributes = '';
                foreach ($child->attributes() as $attributeName => $attributeValue) {
                    if ($this->isDistinguishingAttribute($attributeName)) {
                        $parsedAttributes .= '[@' . $attributeName . '="' . $attributeValue . '"]';
                    }
                }
                $nameOfChild .= $parsedAttributes;
            }
            if (!isset($parsedNode[$nameOfChild])) {
                // We accept only first child when they are non distinguishable (i.e. they differs only by non-distinguishing attributes)
                $parsedNode[$nameOfChild] = $parsedChild;
            }
        }
        return $parsedNode;
    }