protected function call(array $params)
    {
        $defaultParams = [
            'key'        => $this->apiKey,
            'format'     => 'json',
            'apiVersion' => self::VERSION,
        ];

        $params = array_merge($defaultParams, $params);

        $url = sprintf('%s?%s', self::ENDPOINT, http_build_query($params));

        $response = $this->adapter->get($url);

        $result = json_decode($response->getBody()->getContents(), true);

        if ($result['result'] == 'ERR') {
            throw new ApiException($result['message'], $result['code']);
        }

        return $result;
    }
protected function call(array $params)
    {
        $defaultParams = [
            'key'        => $this->apiKey,
            'format'     => 'json',
            'apiVersion' => self::VERSION,
        ];

        $params = array_merge($defaultParams, $params);

        $url = sprintf('%s?%s', self::ENDPOINT, http_build_query($params));

        $response = $this->adapter->get($url);

        $result = json_decode($response->getBody()->getContents(), true);

        if ($result['result'] == 'ERR') {
            throw new ApiException($result['message'], $result['code']);
        }

        return $result;
    }
protected function call ( array $ params ) { $ defaultParams = [ 'key' => $ this -> apiKey , 'format' => 'json' , 'apiVersion' => self :: VERSION , ] ; $ params = array_merge ( $ defaultParams , $ params ) ; $ url = sprintf ( '%s?%s' , self :: ENDPOINT , http_build_query ( $ params ) ) ; $ response = $ this -> adapter -> get ( $ url ) ; $ result = json_decode ( $ response -> getBody ( ) -> getContents ( ) , true ) ; if ( $ result [ 'result' ] == 'ERR' ) { throw new ApiException ( $ result [ 'message' ] , $ result [ 'code' ] ) ; } return $ result ; }
Sends a call to the API

@param array $params

@return array

@throws ApiException If the API call fails
Sends a call to the API