@param array        $service
@param string       $uri
@param array|string $params

@return Restful
327393
public function call(array $service, $params = []): ClientContract
    {
        $this->client->connection([
            'name'     => $service['name'],
            'driver'   => $this->config['driver'],
            'host'     => $service['host'],
            'port'     => $service['port'],
            'settings' => array_merge($this->defaultConfig, $this->config['options'] ?? [], $this->options[$service['name']] ?? []),
        ])->handle('/', ['headers' => $this->headers, 'method' => $this->method, 'payload' => $params]);

        $this->statusCode = $this->client->getStatusCode();
        $this->content = $this->client->getContent();

        $this->client->disconnection();

        return $this;
    }
1149349
public function getService($service = null)
    {
        if ( $service and ! array_key_exists($service, $this->service) )
        {
            $this->setService($service);
        }

        $this->setToken();

        return $this->service[$service];
    }
323586
public function options($service, $headers = [], $body = '', $form_params = [])
    {
        return $this->callRestService('OPTIONS', $service, $headers, $body, $form_params);
    }
18066
public function get($uri, array $params = array())
    {

        $uri .= '?' . http_build_query($params);

        $ch = $this->initCurlHandler($uri);
        return $this->makeRequest($ch);

    }
1358913
protected function buildUrl($uri, $params)
    {
        $host = $this->buildHostString();

        if (strpos($uri, "/") !== 0) {
            $uri = "/" . $uri;
        }

        $url = $host . $uri;


        if ($params === null) {
            $params = array();
        }

        $url .= $this->buildQueryString($params);

        return $url;
    }
173679
private function putService(array $service, string $url)
    {
        $options = [
            'json' => $service,
        ];

        $httpClient = new Client();
        $response = $httpClient->put($url, $options)->getResponse();

        if ($response->getStatusCode() == 200) {
            output()->writeln(sprintf('<success>RPC service register success by consul ! tcp=%s:%d</success>', $this->registerAddress, $this->registerPort));
            return true;
        }
        return false;
    }
1126803
public function request($method, $uri, array $options = []) {
      $apiToken = $this->addTokens();
      try {
         $options['headers']['Content-Type'] = "application/json";
         $sessionHeaders = [];
         if ($apiToken) {
            if (key_exists('Session-Token', $apiToken) && $apiToken['Session-Token']) {
               $sessionHeaders['Session-Token'] = $apiToken['Session-Token'];
            }
            if (key_exists('App-Token', $apiToken) && $apiToken['App-Token']) {
               $sessionHeaders['App-Token'] = $apiToken['App-Token'];
            }
         }
         $options = array_merge_recursive($options, ['headers' => $sessionHeaders]);
         $response = $this->httpClient->request($method, $this->url . $uri, $options);
         return $response;
      } catch (ClientException $e) {
         $response = $e->getResponse();
         /*$body = $response->getBody()->getContents();
         $reasonPhrase = $response->getReasonPhrase() . (($body) ? ' ' . $body : '');*/
         return $response;
      } catch (RequestException $e) {
         $hasResponse = $e->hasResponse();
         $statusCode = ($hasResponse) ? $e->getResponse()->getStatusCode() : '500';
         $contents = ($hasResponse) ? $e->getResponse()->getReasonPhrase() : 'Request Error';
         throw new Exception($contents, $statusCode);
      }
   }
498803
public function create($uri, $method = 'GET', $params = [], $cookie = [], $files = [], $server = [], $content = null)
    {
        $server['PATH_INFO']      = '';
        $server['REQUEST_METHOD'] = strtoupper($method);
        $info                     = parse_url($uri);
        if (isset($info['host'])) {
            $server['SERVER_NAME'] = $info['host'];
            $server['HTTP_HOST']   = $info['host'];
        }
        if (isset($info['scheme'])) {
            if ('https' === $info['scheme']) {
                $server['HTTPS']       = 'on';
                $server['SERVER_PORT'] = 443;
            } else {
                unset($server['HTTPS']);
                $server['SERVER_PORT'] = 80;
            }
        }
        if (isset($info['port'])) {
            $server['SERVER_PORT'] = $info['port'];
            $server['HTTP_HOST']   = $server['HTTP_HOST'] . ':' . $info['port'];
        }
        if (isset($info['user'])) {
            $server['PHP_AUTH_USER'] = $info['user'];
        }
        if (isset($info['pass'])) {
            $server['PHP_AUTH_PW'] = $info['pass'];
        }
        if (!isset($info['path'])) {
            $info['path'] = '/';
        }
        $options                      = [];
        $options[strtolower($method)] = $params;
        $queryString                  = '';
        if (isset($info['query'])) {
            parse_str(html_entity_decode($info['query']), $query);
            if (!empty($params)) {
                $params      = array_replace($query, $params);
                $queryString = http_build_query($query, '', '&');
            } else {
                $params      = $query;
                $queryString = $info['query'];
            }
        } elseif (!empty($params)) {
            $queryString = http_build_query($params, '', '&');
        }
        if ($queryString) {
            parse_str($queryString, $get);
            $options['get'] = isset($options['get']) ? array_merge($get, $options['get']) : $get;
        }

        $server['REQUEST_URI']  = $info['path'] . ('' !== $queryString ? '?' . $queryString : '');
        $server['QUERY_STRING'] = $queryString;
        $options['cookie']      = $cookie;
        $options['param']       = $params;
        $options['file']        = $files;
        $options['server']      = $server;
        $options['url']         = $server['REQUEST_URI'];
        $options['baseUrl']     = $info['path'];
        $options['pathinfo']    = '/' == $info['path'] ? '/' : ltrim($info['path'], '/');
        $options['method']      = $server['REQUEST_METHOD'];
        $options['domain']      = isset($info['scheme']) ? $info['scheme'] . '://' . $server['HTTP_HOST'] : '';
        $options['content']     = $content;
        foreach ($options as $name => $item) {
            if (property_exists($this, $name)) {
                $this->$name = $item;
            }
        }
        return $this;
    }
785407
protected function _request( $uri, array $params = array() )
    {
        $this->_client->setUri($uri);
        $this->_client->setParameterGet($params);

        try {
            $response = $this->_client->request();
        } catch (Exception $e) {
            return null;
        }

        if ( $response->getStatus() != 200 ) {
            return false;
        }

        return $response->getBody();
    }
1213757
public function url($service)
    {
        $url = 'index.php?option=com_connect&view=login&server='.$service;

        if (AnRequest::get('get.return', 'cmd')) {
            $url .= '&return='.AnRequest::get('get.return', 'raw');
        }

        return route($url);
    }
515637
protected function getResponse($uri, array $queryParams = array())
    {
        $request = $this->httpClient->get($uri, array(), array('query' => $queryParams));

        return $request->send()->json();
    }
1315933
public function setService($services)
    {
        if (!is_array($services)) {
            throw new \Exception(__METHOD__.' accept parameter as array.');
        }

        foreach ($services as $key => $alias) {
            $this[$key] = $alias;
        }

        return $this;
    }
113312
public static function make($uri, $params = [], $queryDelimeter = '?')
    {
        $uri .= (strstr($uri, $queryDelimeter) === false) ? $queryDelimeter : '&';

        return $uri.http_build_query($params);
    }
336626
public function getApiUri($service, $operation, $params = [], $format = 'xml')
    {
        $config = Mage::helper('radial_core')->getConfigModel();

        return sprintf(
            self::URI_FORMAT,
            $config->apiHostname,
            $config->apiMajorVersion,
            $config->apiMinorVersion,
            $config->storeId,
            $service,
            $operation,
            (!empty($params)) ? '/' . implode('/', $params) : '',
            $format
        );
    }
290633
public function post( $uri, array $params = array() )
    {
        $this->_client->setMethod('POST');
        return $this->_request($uri, $params);
    }
877949
public function get($uri, $parameters = array())
    {
        return $this->request(self::METHOD_GET, $this->getUrl($uri), $parameters);
    }
1108042
public static function full( $uri = '', $params = array(), $retain = false ) 
	{
		return CCIn::protocol().'://'.CCIn::host().static::to( $uri, $params, $retain );
	}