public function query($name, $parameters = [])
    {
        if (!isset($parameters['APPID'])) {
            $parameters['APPID'] = $this->apiKey;
        }

        if (!isset($parameters['units'])) {
            $parameters['units'] = $this->units;
        }

        if (!isset($parameters['lang'])) {
            $parameters['lang'] = $this->lang;
        }

        $baseUrl = $this->apiUrl.$name;

        $requestQueryParts = [];
        foreach ($parameters as $key => $value) {
            $requestQueryParts[] = $key.'='.rawurlencode($value);
        }
        $baseUrl .= '?'.implode('&', $requestQueryParts);

        $response = $this->guzzleClient->get($baseUrl);
        $response = json_decode($response->getBody()->getContents());

        return $response;
    }
public function query($name, $parameters = [])
    {
        if (!isset($parameters['APPID'])) {
            $parameters['APPID'] = $this->apiKey;
        }

        if (!isset($parameters['units'])) {
            $parameters['units'] = $this->units;
        }

        if (!isset($parameters['lang'])) {
            $parameters['lang'] = $this->lang;
        }

        $baseUrl = $this->apiUrl.$name;

        $requestQueryParts = [];
        foreach ($parameters as $key => $value) {
            $requestQueryParts[] = $key.'='.rawurlencode($value);
        }
        $baseUrl .= '?'.implode('&', $requestQueryParts);

        $response = $this->guzzleClient->get($baseUrl);
        $response = json_decode($response->getBody()->getContents());

        return $response;
    }
public function query ( $ name , $ parameters = [ ] ) { if ( ! isset ( $ parameters [ 'APPID' ] ) ) { $ parameters [ 'APPID' ] = $ this -> apiKey ; } if ( ! isset ( $ parameters [ 'units' ] ) ) { $ parameters [ 'units' ] = $ this -> units ; } if ( ! isset ( $ parameters [ 'lang' ] ) ) { $ parameters [ 'lang' ] = $ this -> lang ; } $ baseUrl = $ this -> apiUrl . $ name ; $ requestQueryParts = [ ] ; foreach ( $ parameters as $ key => $ value ) { $ requestQueryParts [ ] = $ key . '=' . rawurlencode ( $ value ) ; } $ baseUrl .= '?' . implode ( '&' , $ requestQueryParts ) ; $ response = $ this -> guzzleClient -> get ( $ baseUrl ) ; $ response = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; return $ response ; }
Performs a query to the OpenWeatherMap API.

@param string $name
@param array $parameters

@return stdClass
Performs a query to the OpenWeatherMap API .