Xml.php
public static function toArray($obj)
    {
        if ($obj instanceof \DOMNode) {
            $obj = simplexml_import_dom($obj);
        }
        if (!($obj instanceof \SimpleXMLElement)) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'The input is not instance of SimpleXMLElement, DOMDocument or DOMNode.'));
        }
        $result = [];
        $namespaces = array_merge(['' => ''], $obj->getNamespaces(true));
        self::_toArray($obj, $result, '', array_keys($namespaces));

        return $result;
    }
public static function toArray($obj)
    {
        if ($obj instanceof \DOMNode) {
            $obj = simplexml_import_dom($obj);
        }
        if (!($obj instanceof \SimpleXMLElement)) {
            throw new \RuntimeException(Tools::poorManTranslate('fts-shared', 'The input is not instance of SimpleXMLElement, DOMDocument or DOMNode.'));
        }
        $result = [];
        $namespaces = array_merge(['' => ''], $obj->getNamespaces(true));
        self::_toArray($obj, $result, '', array_keys($namespaces));

        return $result;
    }
Returns this XML structure as a array.

@param \SimpleXMLElement|\DOMDocument|\DOMNode $obj SimpleXMLElement, DOMDocument or DOMNode instance
@return array Array representation of the XML structure.
@throws \RuntimeException