@codeCoverageIgnore

@return \GuzzleHttp\Client
769897
protected function createClient()
    {
        return new Client([
            'base_uri' => $this->baseUrl,
            'handler'  => $this->handlerStack,
            RequestOptions::HTTP_ERRORS => false,
            RequestOptions::AUTH => [$this->app->getClientId(), $this->app->getClientSecret()],
            RequestOptions::TIMEOUT => $this->requestTimeout,
        ]);
    }
1142260
public function getSingle()
    {
        // Set the endpoint
        $endpoint = $this->buildEndpoint();

        // Set the header
        $this->buildHttpHeader();

        // Send the request
        $client = new Client(); //GuzzleHttp\Client

        try {
            $response = $client->request('GET', $endpoint, [
                'headers' => $this->headers,
                'query' => ['$select' => $this->select,
                    'id' => $this->recordID,
                ],
                'curl' => $this->setGetCurlopts(),
            ]);

        } catch (\GuzzleException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        } catch (\GuzzleHttp\Exception\RequestException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        } catch (\GuzzleHttp\Exception\ServerException $e) {
            $this->errorMessage = $e->getResponse()->getBody()->getContents();
            return false;
        }

        return json_decode($response->getBody(), true);
    }
438430
protected function createLaravelDriver(): Sdk\Client
    {
        return \tap($this->createHttpClient(), function ($client) {
            if (isset($this->config['client_id']) || isset($this->config['client_secret'])) {
                $client->setClientId($this->config['client_id'])
                        ->setClientSecret($this->config['client_secret']);
            }

            if (isset($this->config['access_token'])) {
                $client->setAccessToken($this->config['access_token']);
            }
        });
    }
88516
public function send()
    {
        try {
            $response = $this->guzzleClient->request($this->method, $this->uri, $this->options);
        } catch (ClientException $e) {
            $this->handleApiException($e->getResponse()->getBody()->getContents());
        }

        return $this->getBody($response);
    }
269678
protected function setClient($clientOptions = [])
    {
        $this->createClient($clientOptions);
        $this->consumer = new GuzzleClient($this->client, $this->description);

        return $this;
    }
3170
function getClient()
    {
        $transport = $this->getTransport();
        $transport->setAuth($this->username, $this->password);

        return new Client($transport);
    }
217883
private function buildGuzzleSender(GuzzleClientInterface $client = null)
    {
        if (!$client) {
            if (!class_exists(GuzzleClient::class)) {
                throw new RuntimeException("You need to install 'guzzlehttp/guzzle' to use it as a sender");
            }

            $client = new GuzzleClient();
        }

        return new GuzzleSender($client);
    }
987351
protected function createHttpClientOption()
    {
        $options = [];
        if ($this->config->getDebug()) {
            $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a');
            if (!$options[RequestOptions::DEBUG]) {
                throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile());
            }
        }

        return $options;
    }
1016229
public function getHttpClient()
    {
        if (!is_object($this->_httpClient)) {
            $this->_httpClient = new Client([
                'requestConfig' => [
                    'format' => Client::FORMAT_XML
                ],
                'responseConfig' => [
                    'format' => Client::FORMAT_XML
                ],
            ]);
        }
        return $this->_httpClient;
    }
1004140
public function build(): Client
    {
        return new Client(
            new CommandBus(
                [
                    new LockingMiddleware(),
                    new ExceptionMiddleware(),
                    new ValidationMiddleware(),
                    new CommandHandlerMiddleware(
                        new ClassNameExtractor(),
                        new CallableLocator($this->getCommandResolver()),
                        new ClassNameWithoutSuffixInflector('Request')
                    )
                ]
            )
        );
    }
851081
public function getOAuth2Client()
    {
        if (!$this->oAuth2Client instanceof OAuth2Client) {
            return new OAuth2Client(
                $this->getApp(),
                $this->getClient(),
                $this->getRandomStringGenerator()
            );
        }

        return $this->oAuth2Client;
    }
1011090
public function createDefaultHttpClient()
    {
        $stack = HandlerStack::create();

        $middleware = new Oauth1([
            'consumer_key'    => $this->consumerKey,
            'consumer_secret' => $this->consumerSecret,
            'token'           => $this->token,
            'token_secret'    => $this->tokenSecret
        ]);

        $stack->push($middleware);

        return new HttpClient([
            'handler' => $stack
        ]);
    }
998644
public function getClient(): ClientInterface
    {
        if ($this->client === null) {
            $this->client = new Client();
        }

        return $this->client;
    }
1118616
public function getHttpClient()
    {
        if (is_null($this->httpClient)) {
            $this->httpClient = $this->getDefaultHttpClient();
        }

        return $this->httpClient;
    }
851862
public function getClient()
    {
        if ( $this->client ) {
            return $this->client;
        }

        $this->client = new Client(self::BASE_URL);

        return $this->client;
    }
1156009
protected function getHttpClient()
    {
        $options = [
            'base_url'    => 'https://api.bitbucket.org',
            'api_version' => '1.0',
            'verify_peer' => true,
        ];

        $client = new Client($options);

        $client->addListener(new NormalizeArrayListener());

        return $client;
    }
1298248
public function getGuzzleClient()
    {
        $guzzle = $this->guzzleClient;

        if ($this->retry) {
            $guzzle = $this->addRetrySubscriber($guzzle);
        }

        return $guzzle;
    }