yii\httpclient\XmlParser::convertXmlToArray PHP Méthode

convertXmlToArray() protected méthode

Converts XML document to array.
protected convertXmlToArray ( string | SimpleXMLElement $xml ) : array
$xml string | SimpleXMLElement xml to process.
Résultat array XML array representation.
    protected function convertXmlToArray($xml)
    {
        if (!is_object($xml)) {
            $xml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
        }
        $result = (array) $xml;
        foreach ($result as $key => $value) {
            if (is_object($value)) {
                $result[$key] = $this->convertXmlToArray($value);
            }
        }
        return $result;
    }