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);
    }