protected function handleXmlResponse(ResponseInterface $response, $url)
    {
        if (false !== strpos((string) $response->getBody(), 'xmlns:e="http://xml.theplatform.com/exception"')) {
            if (preg_match('~<e:title>(.+)</e:title><e:description>(.+)</e:description><e:responseCode>(.+)</e:responseCode>~', (string) $response->getBody(), $matches)) {
                throw new ApiException("Error {$matches[1]} on request to {$url}: {$matches[2]}", (int) $matches[3]);
            } elseif (preg_match('~<title>(.+)</title><summary>(.+)</summary><e:responseCode>(.+)</e:responseCode>~', (string) $response->getBody(), $matches)) {
                throw new ApiException("Error {$matches[1]} on request to {$url}: {$matches[2]}", (int) $matches[3]);
            }
        }
        $data = simplexml_load_string($response->getBody()->getContents());
        $data = [$data->getName() => static::convertXmlToArray($data)];

        return $data;
    }
protected function handleXmlResponse(ResponseInterface $response, $url)
    {
        if (false !== strpos((string) $response->getBody(), 'xmlns:e="http://xml.theplatform.com/exception"')) {
            if (preg_match('~<e:title>(.+)</e:title><e:description>(.+)</e:description><e:responseCode>(.+)</e:responseCode>~', (string) $response->getBody(), $matches)) {
                throw new ApiException("Error {$matches[1]} on request to {$url}: {$matches[2]}", (int) $matches[3]);
            } elseif (preg_match('~<title>(.+)</title><summary>(.+)</summary><e:responseCode>(.+)</e:responseCode>~', (string) $response->getBody(), $matches)) {
                throw new ApiException("Error {$matches[1]} on request to {$url}: {$matches[2]}", (int) $matches[3]);
            }
        }
        $data = simplexml_load_string($response->getBody()->getContents());
        $data = [$data->getName() => static::convertXmlToArray($data)];

        return $data;
    }
protected function handleXmlResponse ( ResponseInterface $ response , $ url ) { if ( false !== strpos ( ( string ) $ response -> getBody ( ) , 'xmlns:e="http://xml.theplatform.com/exception"' ) ) { if ( preg_match ( '~<e:title>(.+)</e:title><e:description>(.+)</e:description><e:responseCode>(.+)</e:responseCode>~' , ( string ) $ response -> getBody ( ) , $ matches ) ) { throw new ApiException ( "Error {$matches[1]} on request to {$url}: {$matches[2]}" , ( int ) $ matches [ 3 ] ) ; } elseif ( preg_match ( '~<title>(.+)</title><summary>(.+)</summary><e:responseCode>(.+)</e:responseCode>~' , ( string ) $ response -> getBody ( ) , $ matches ) ) { throw new ApiException ( "Error {$matches[1]} on request to {$url}: {$matches[2]}" , ( int ) $ matches [ 3 ] ) ; } } $ data = simplexml_load_string ( $ response -> getBody ( ) -> getContents ( ) ) ; $ data = [ $ data -> getName ( ) => static :: convertXmlToArray ( $ data ) ] ; return $ data ; }
Handle an XML API response.

@param ResponseInterface $response The response.
@param string            $url      The request URL.

@throws \Lullabot\Mpx\Exception\ApiException If an error occurred.

@return array The decoded response data.
Handle an XML API response .