src/Alchemy/Geonames/Connector.php
private function get($endPoint, array $queryParameters = array())
    {
        $request = $this->client->get($this->serverUri . $endPoint, array(
            'accept' => 'application/json'
        ));

        foreach ($queryParameters as $key => $value) {
            $request->getQuery()->add($key, $value);
        }

        try {
            $result = json_decode($request->send()->getBody(true), true);
        } catch (ClientErrorResponseException $e) {
            if (404 === $e->getResponse()->getStatusCode()) {
                throw new NotFoundException('Resource not found', $e->getCode(), $e);
            }
            throw new TransportException('Failed to execute query', $e->getCode(), $e);
        } catch (GuzzleException $e) {
            throw new TransportException('Failed to execute query', $e->getCode(), $e);
        }

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new TransportException('Unable to parse result');
        }

        return $result;
    }
private function get($endPoint, array $queryParameters = array())
    {
        $request = $this->client->get($this->serverUri . $endPoint, array(
            'accept' => 'application/json'
        ));

        foreach ($queryParameters as $key => $value) {
            $request->getQuery()->add($key, $value);
        }

        try {
            $result = json_decode($request->send()->getBody(true), true);
        } catch (ClientErrorResponseException $e) {
            if (404 === $e->getResponse()->getStatusCode()) {
                throw new NotFoundException('Resource not found', $e->getCode(), $e);
            }
            throw new TransportException('Failed to execute query', $e->getCode(), $e);
        } catch (GuzzleException $e) {
            throw new TransportException('Failed to execute query', $e->getCode(), $e);
        }

        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new TransportException('Unable to parse result');
        }

        return $result;
    }
private function get ( $ endPoint , array $ queryParameters = array ( ) ) { $ request = $ this -> client -> get ( $ this -> serverUri . $ endPoint , array ( 'accept' => 'application/json' ) ) ; foreach ( $ queryParameters as $ key => $ value ) { $ request -> getQuery ( ) -> add ( $ key , $ value ) ; } try { $ result = json_decode ( $ request -> send ( ) -> getBody ( true ) , true ) ; } catch ( ClientErrorResponseException $ e ) { if ( 404 === $ e -> getResponse ( ) -> getStatusCode ( ) ) { throw new NotFoundException ( 'Resource not found' , $ e -> getCode ( ) , $ e ) ; } throw new TransportException ( 'Failed to execute query' , $ e -> getCode ( ) , $ e ) ; } catch ( GuzzleException $ e ) { throw new TransportException ( 'Failed to execute query' , $ e -> getCode ( ) , $ e ) ; } if ( JSON_ERROR_NONE !== json_last_error ( ) ) { throw new TransportException ( 'Unable to parse result' ) ; } return $ result ; }
Executes a GET HTTP query.

@param string $endPoint
@param array  $queryParameters

@return array

@throws NotFoundException
@throws TransportException
Executes a GET HTTP query .