final protected function parseSimpleXML(\SimpleXMLElement $element)
    {
        $elements = [];

        foreach ($element->attributes() as $attribute => $value) {
            $elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value;
        }

        foreach ($element->children() as $node => $child) {
            $elements[$node] = $child instanceof \SimpleXMLElement ? $this->parseSimpleXML($child) : $child;
        }

        if ($element->count() === 0 && \trim((string) $element) !== '') {
            $value = $this->getTypedValue((string) $element);

            if (\count($elements) === 0) {
                return $value;
            }

            $elements['_value_'] = $value;
        }

        return $elements;
    }
final protected function parseSimpleXML(\SimpleXMLElement $element)
    {
        $elements = [];

        foreach ($element->attributes() as $attribute => $value) {
            $elements[$attribute] = $value instanceof \SimpleXMLElement ? $this->parseSimpleXML($value) : $value;
        }

        foreach ($element->children() as $node => $child) {
            $elements[$node] = $child instanceof \SimpleXMLElement ? $this->parseSimpleXML($child) : $child;
        }

        if ($element->count() === 0 && \trim((string) $element) !== '') {
            $value = $this->getTypedValue((string) $element);

            if (\count($elements) === 0) {
                return $value;
            }

            $elements['_value_'] = $value;
        }

        return $elements;
    }
final protected function parseSimpleXML ( \ SimpleXMLElement $ element ) { $ elements = [ ] ; foreach ( $ element -> attributes ( ) as $ attribute => $ value ) { $ elements [ $ attribute ] = $ value instanceof \ SimpleXMLElement ? $ this -> parseSimpleXML ( $ value ) : $ value ; } foreach ( $ element -> children ( ) as $ node => $ child ) { $ elements [ $ node ] = $ child instanceof \ SimpleXMLElement ? $ this -> parseSimpleXML ( $ child ) : $ child ; } if ( $ element -> count ( ) === 0 && \ trim ( ( string ) $ element ) !== '' ) { $ value = $ this -> getTypedValue ( ( string ) $ element ) ; if ( \ count ( $ elements ) === 0 ) { return $ value ; } $ elements [ '_value_' ] = $ value ; } return $ elements ; }
Parse xml to array.

@param \SimpleXMLElement $element

@return string|float|int|bool|array
Parse xml to array .