protected function getNewHttpClient($method, $params, $accessToken = null)
    {
        $config = [
            'http_errors' => $this->getHttpErrors(),
            'base_uri' => $this->baseUri,
            'timeout' => $this->getTimeout(),
            'headers' => [
                'Client-ID' => $this->getClientId(),
                'Accept' => sprintf('application/vnd.twitchtv.v%d+json', $this->getApiVersion()),
                'User-Agent' => ($this->getUserAgent() !== null) ? $this->getUserAgent() : GuzzleHttp\default_user_agent(),
            ],
        ];

        if ($accessToken) {
            $config['headers']['Authorization'] = sprintf('OAuth %s', $accessToken);
        }

        if (!empty($params)) {
            $config[($method == self::GET_METHOD) ? 'query' : 'json'] = $params;
        }

        return new GuzzleHttp\Client($config);
    }
protected function getNewHttpClient($method, $params, $accessToken = null)
    {
        $config = [
            'http_errors' => $this->getHttpErrors(),
            'base_uri' => $this->baseUri,
            'timeout' => $this->getTimeout(),
            'headers' => [
                'Client-ID' => $this->getClientId(),
                'Accept' => sprintf('application/vnd.twitchtv.v%d+json', $this->getApiVersion()),
                'User-Agent' => ($this->getUserAgent() !== null) ? $this->getUserAgent() : GuzzleHttp\default_user_agent(),
            ],
        ];

        if ($accessToken) {
            $config['headers']['Authorization'] = sprintf('OAuth %s', $accessToken);
        }

        if (!empty($params)) {
            $config[($method == self::GET_METHOD) ? 'query' : 'json'] = $params;
        }

        return new GuzzleHttp\Client($config);
    }
protected function getNewHttpClient ( $ method , $ params , $ accessToken = null ) { $ config = [ 'http_errors' => $ this -> getHttpErrors ( ) , 'base_uri' => $ this -> baseUri , 'timeout' => $ this -> getTimeout ( ) , 'headers' => [ 'Client-ID' => $ this -> getClientId ( ) , 'Accept' => sprintf ( 'application/vnd.twitchtv.v%d+json' , $ this -> getApiVersion ( ) ) , 'User-Agent' => ( $ this -> getUserAgent ( ) !== null ) ? $ this -> getUserAgent ( ) : GuzzleHttp \ default_user_agent ( ) , ] , ] ; if ( $ accessToken ) { $ config [ 'headers' ] [ 'Authorization' ] = sprintf ( 'OAuth %s' , $ accessToken ) ; } if ( ! empty ( $ params ) ) { $ config [ ( $ method == self :: GET_METHOD ) ? 'query' : 'json' ] = $ params ; } return new GuzzleHttp \ Client ( $ config ) ; }
Get a new HTTP Client

@param strring $method
@param array   $params
@param string  $accessToken
@return Client
Get a new HTTP Client