protected function parse($body)
    {
        $disableEntities = libxml_disable_entity_loader(true);
        $internalErrors = libxml_use_internal_errors(true);

        try {
            $xml = new SimpleXMLElement((string) $body ?: '<root />', LIBXML_NONET);

            return json_decode(json_encode($xml), true);
        } catch (Exception $e) {
            //
        } catch (Throwable $e) {
            //
        } finally {
            libxml_disable_entity_loader($disableEntities);
            libxml_use_internal_errors($internalErrors);
        }
    }
protected function parse($body)
    {
        $disableEntities = libxml_disable_entity_loader(true);
        $internalErrors = libxml_use_internal_errors(true);

        try {
            $xml = new SimpleXMLElement((string) $body ?: '<root />', LIBXML_NONET);

            return json_decode(json_encode($xml), true);
        } catch (Exception $e) {
            //
        } catch (Throwable $e) {
            //
        } finally {
            libxml_disable_entity_loader($disableEntities);
            libxml_use_internal_errors($internalErrors);
        }
    }
protected function parse ( $ body ) { $ disableEntities = libxml_disable_entity_loader ( true ) ; $ internalErrors = libxml_use_internal_errors ( true ) ; try { $ xml = new SimpleXMLElement ( ( string ) $ body ? : '<root />' , LIBXML_NONET ) ; return json_decode ( json_encode ( $ xml ) , true ) ; } catch ( Exception $ e ) { // } catch ( Throwable $ e ) { // } finally { libxml_disable_entity_loader ( $ disableEntities ) ; libxml_use_internal_errors ( $ internalErrors ) ; } }
Parse an xml string to an array.

@param string $body

@return array
Parse an xml string to an array .