Возвращает подготовленный Guzzle-клиент для отправки HTTP-запроса
@return GuzzleClient
17534
protected function getGuzzle()
    {
        $headers = array_merge([
            'Content-Type' => 'application/json',
            'Accept' => 'application/json'
        ], $this->additionalHeaders);

        // Сбрасываем доп. заголовки для последующих запросов
        $this->additionalHeaders = [];

        return new GuzzleClient([
            'headers' => $headers,
            'verify' => false
        ]);
    }
661892
public static function find()
    {
        try {
            $client = static::findOneByType(HttpClient::class);
        } catch (DiscoveryFailedException $e) {
            throw new NotFoundException(
                'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".',
                0,
                $e
            );
        }

        return static::instantiateClass($client);
    }
1113970
protected function getGuzzleHandler()
    {
        if (property_exists($this, 'app') && isset($this->app['guzzle_handler']) && is_string($this->app['guzzle_handler'])) {
            $handler = $this->app['guzzle_handler'];

            return new $handler();
        }

        return \GuzzleHttp\choose_handler();
    }
1200522
public function generateHttpClient()
    {
        $config = $this->config;
        if (!array_key_exists('handler', $config)
            || $config['handler'] === null) {
            $config['handler'] = HandlerStack::create();
        }

        // Add a logging middleware required by this library.
        $config['handler']->before(
            'http_errors',
            GuzzleLogMessageHandler::log($this->logger, $this->messageFormatter)
        );

        return new Client($config);
    }
343142
public function getOpenedClient()
    {
        if (!isset($this->openedClient)) {
            $this->openedClient = new ServiceClient();
            $this->openedClient->setApiKey($this->getParameter('apiKey'));

            $newClient = new \Zend\Http\Client(
                null,
                [
                    'adapter'       => 'Zend\Http\Client\Adapter\Socket',
                    'sslverifypeer' => false,
                ]
            );

            $this->openedClient->setHttpClient($newClient);
        }

        return $this->openedClient;
    }
482698
private function chooseHttpClient()
    {
        if (null !== $this->httpClient) {
            return $this->httpClient;
        }

        $this->consoleLogger
            ->debug('Choosing HttpClient implementation.');

        if (\function_exists('curl_exec')) {
            $this->httpClient = $this->curlHttpClient;

            $this->consoleLogger
                ->debug('cURL available, use <info>CurlHttpClient</info>.');

            return $this->httpClient;
        }

        if ('1' === \ini_get('allow_url_fopen')) {
            $this->httpClient = $this->streamHttpClient;

            $this->consoleLogger
                ->debug("'allow_url_fopen' enabled, use <info>StreamHttpClient</info>");

            return $this->httpClient;
        }

        $this->consoleLogger
            ->debug('<error>Choosing HttpClient implementation failed.</error>');

        throw new HttpClientException(
            "Unable to choose HttpClient. Enable cURL extension (preffered) or turn on 'allow_url_fopen' in php.ini."
        );
    }
802898
public function getGuzzle()
    {

        if ($this->guzzle)
            return $this->guzzle;

        $this->guzzle = new Client();

        return $this->guzzle;

    }
1264359
function get()
    {
        $result = $this->client->get($this->requestDecorator->makeResource(), $this->requestDecorator->makeQuery());
        $this->refresh();
        return $result;
    }
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);
    }
916192
protected function http() {
        // 若$this->http不是\GuzzleHttp\Client实例，则创建一个
        if (!$this->http instanceof Client) {
            $this->http = new Client(
                array_merge(
                    [ 'base_uri' => $this->url ],
                    $this->options
                )
            );
        }

        return $this->http;
    }
1232996
protected function makeServicesClient(Client $client)
    {
        $parameters = $this->getDescription();

        $description = new Description($parameters);

        return new GuzzleClient($client, $description);
    }
721575
protected function getClient(): HttpClient
    {
        if ($this->client === null) {
            $this->client = new HttpClient($this->getClientConfig());
        }

        return $this->client;
    }
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
        ]);
    }
76184
public function getHttpClient() {
    if ($this->httpClient === NULL) {
      $this->httpClient = new HttpClient($this->options);
    }

    return $this->httpClient;
  }
735033
protected function getClient()
    {
        $retries   = 5;
        $httpCodes = null;
        $curlCodes = null;

        $plugin = BackoffPlugin::getExponentialBackoff($retries, $httpCodes, $curlCodes);
        $client = new Client($this->baseUrl);
        $client->addSubscriber($plugin);

        return $client;
    }
427608
public function bindHttpClient()
    {
        $this->app->bind(HttpClient::class, function (Application $app) {
            $client = $app->make('ej:sdk:guzzle');
            $auth = $app->make(Authentication\Authenticator::class);

            return new HttpClient($client, $auth);
        });
    }
305333
public function send()
	{
		$mappedParams = $this->map();

		$curler = new \GuzzleHttp\Client(['base_uri' => $this->tgUrl]);

		if (empty($this->multipart)) {
			$response = $curler->request("POST", static::$method, [
				"query" => $mappedParams
			]);
		} else {
			$response = $curler->request("POST", static::$method, [
				"query" => $mappedParams,
				"multipart" => $this->multipart
			]);
		}

		$jsonResponse = json_decode((string)$response->getBody(), true);
		$result = $jsonResponse['result'];
		return static::decodeResult($result);
	}