src/Nominatim.php
private function decodeResponse(string $format, Request $request, ResponseInterface $response)
    {
        if ('json' === $format || 'jsonv2' === $format || 'geojson' === $format || 'geocodejson' === $format) {
            return \json_decode($response->getBody()->getContents(), true);
        }

        if ('xml' === $format) {
            return new \SimpleXMLElement($response->getBody()->getContents());
        }

        throw new NominatimException('Format is undefined or not supported for decode response', $request, $response);
    }
private function decodeResponse(string $format, Request $request, ResponseInterface $response)
    {
        if ('json' === $format || 'jsonv2' === $format || 'geojson' === $format || 'geocodejson' === $format) {
            return \json_decode($response->getBody()->getContents(), true);
        }

        if ('xml' === $format) {
            return new \SimpleXMLElement($response->getBody()->getContents());
        }

        throw new NominatimException('Format is undefined or not supported for decode response', $request, $response);
    }
private function decodeResponse ( string $ format , Request $ request , ResponseInterface $ response ) { if ( 'json' === $ format || 'jsonv2' === $ format || 'geojson' === $ format || 'geocodejson' === $ format ) { return \ json_decode ( $ response -> getBody ( ) -> getContents ( ) , true ) ; } if ( 'xml' === $ format ) { return new \ SimpleXMLElement ( $ response -> getBody ( ) -> getContents ( ) ) ; } throw new NominatimException ( 'Format is undefined or not supported for decode response' , $ request , $ response ) ; }
Decode the data returned from the request.

@param string            $format   json or xml
@param Request           $request  Request object from Guzzle
@param ResponseInterface $response Interface response object from Guzzle

@throws \RuntimeException
@throws \maxh\Nominatim\Exceptions\NominatimException if no format for decode

@return array|\SimpleXMLElement
Decode the data returned from the request .