Set the Zend_Http_Client object used for communication

@param Zend_Http_Client $client The client to use for communication
@throws Zend_Gdata_App_HttpException
@return Zend_Gdata_App Provides a fluent interface
770432
public function setHttpClient($client,
        $applicationId = 'MyCompany-MyApp-1.0', $clientId = null,
        $developerKey = null)
    {
        if ($client === null) {
            $client = new Zend_Http_Client();
        }
        if (!$client instanceof Zend_Http_Client) {
            require_once 'Zend/Gdata/App/HttpException.php';
            throw new Zend_Gdata_App_HttpException(
                'Argument is not an instance of Zend_Http_Client.');
        }

        if ($clientId != null) {
            $client->setHeaders('X-GData-Client', $clientId);
        }

        if ($developerKey != null) {
            $client->setHeaders('X-GData-Key', 'key='. $developerKey);
        }

        return parent::setHttpClient($client, $applicationId);
    }
488225
public function request($method = null)
    {
        if (! $this->uri instanceof Zend_Uri_Http) {
            /**
 * @see Zend_Http_Client_Exception 
*/
            include_once 'Zend/Http/Client/Exception.php';
            throw new Zend_Http_Client_Exception('No valid URI has been passed to the client');
        }

        if ($method) { $this->setMethod($method);
        }
        $this->redirectCounter = 0;
        $response = null;

        // Make sure the adapter is loaded
        if ($this->adapter == null) { $this->setAdapter($this->config['adapter']);
        }

        // Send the first request. If redirected, continue.
        do {
            // Clone the URI and add the additional GET parameters to it
            $uri = clone $this->uri;
            if (! empty($this->paramsGet)) {
                $query = $uri->getQuery();
                if (! empty($query)) { $query .= '&';
                }
                $query .= http_build_query($this->paramsGet, null, '&');

                $uri->setQuery($query);
            }

            $body = $this->_prepareBody();
            $headers = $this->_prepareHeaders();

            // Open the connection, send the request and read the response
            $this->adapter->connect(
                $uri->getHost(), $uri->getPort(),
                ($uri->getScheme() == 'https' ? true : false)
            );

            $this->last_request = $this->adapter->write(
                $this->method,
                $uri, $this->config['httpversion'], $headers, $body
            );

            $response = $this->adapter->read();
            if (! $response) {
                /**
 * @see Zend_Http_Client_Exception 
*/
                include_once 'Zend/Http/Client/Exception.php';
                throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
            }

            $response = Zend_Http_Response::fromString($response);
            if ($this->config['storeresponse']) { $this->last_response = $response;
            }

            // Load cookies into cookie jar
            if (isset($this->cookiejar)) { $this->cookiejar->addCookiesFromResponse($response, $uri);
            }

            // If we got redirected, look for the Location header
            if ($response->isRedirect() && ($location = $response->getHeader('location'))) {

                // Check whether we send the exact same request again, or drop the parameters
                // and send a GET request
                if ($response->getStatus() == 303 
                    || ((! $this->config['strictredirects']) && ($response->getStatus() == 302 
                    || $response->getStatus() == 301))
                ) {

                    $this->resetParameters();
                    $this->setMethod(self::GET);
                }

                // If we got a well formed absolute URI
                if (Zend_Uri_Http::check($location)) {
                    $this->setHeaders('host', null);
                    $this->setUri($location);

                } else {

                    // Split into path and query and set the query
                    if (strpos($location, '?') !== false) {
                        list($location, $query) = explode('?', $location, 2);
                    } else {
                        $query = '';
                    }
                    $this->uri->setQuery($query);

                    // Else, if we got just an absolute path, set it
                    if(strpos($location, '/') === 0) {
                        $this->uri->setPath($location);

                        // Else, assume we have a relative path
                    } else {
                        // Get the current path directory, removing any trailing slashes
                        $path = $this->uri->getPath();
                        $path = rtrim(substr($path, 0, strrpos($path, '/')), "/");
                        $this->uri->setPath($path . '/' . $location);
                    }
                }
                ++$this->redirectCounter;

            } else {
                // If we didn't get any location, stop redirecting
                break;
            }

        } while ($this->redirectCounter < $this->config['maxredirects']);

        return $response;
    }
670063
protected function getClient(): HttpClient
    {
        if ($this->_client == null) {
            $this->_client = new HttpClient(['base_uri' => $this->_endpoint]);
        }

        return $this->_client;
    }
73875
protected function createHttpClient(): Sdk\Client
    {
        $client = new Sdk\Client($this->app->make('katsana.http'));

        if (($this->config['environment'] ?? 'production') === 'carbon') {
            $client->useCustomApiEndpoint('https://carbon.api.katsana.com');
        }

        return $client;
    }
48650
public function setClient(DeliveryChoiceClient $client)
    {
        $client->getConfig()->setPath(HttpClient::CURL_OPTIONS . "/" . CURLOPT_TIMEOUT, self::HTTP_REQUEST_TIMEOUT);
        $this->client = $client;
    }
1301523
public function setHttpClient(Client $client = null)
    {
        if ($client === null) {
            $client = new Client(
                HttpClientDiscovery::find(),
                MessageFactoryDiscovery::find()
            );
        }
        $this->client = $client;
        return $this;
    }
1285098
public function setApiUri(string $apiUri): Client
    {
        $this->apiUri = $apiUri;
        $this->setUris();

        return $this;
    }
423537
public function setClient(\OAuth2\ServerBundle\Entity\Client $client = null)
    {
        $this->client = $client;

        return $this;
    }
1064020
public function client($name = null)
    {
        if (is_null($name)) {
            $name = $this->getDefaultName();
        }

        if (! isset($this->clients[$name])) {
            $this->clients[$name] = new Client(
                $this->getWebhookForClient($name),
                $this->getMessageDefaultsForClient($name),
                $this->getHttpClientForClient($name)
            );
        }

        return $this->clients[$name];
    }
443018
public function setClient($endpoint = null)
    {
        // Create client using API endpoint.
        $this->client = new Client([
                                       'base_uri' => ! is_null($endpoint) ? $endpoint : $this->endpoint,
                                   ]);

        return $this;
    }
1033302
public function setClient($group, $name, Client $client)
    {
        // Must also be service manager aware.
        if (!$client instanceof ServiceManagerAware) {
            throw new \UnexpectedValueException('Client must implement Acquia\Rest\ServiceManagerAware');
        }

        $builder = $this[$group];

        // Set the client in the service builder.
        $builder[$name] = $client;

        // This looks funky, but it is actually not overwriting the value we
        // just set. This snippet adds the builder config so that saving the
        // service will add this client as a service in the JSON file.
        // @see \Guzzle\Service\Builder\ServiceBuilder::set()
        $builder[$name] = array(
            'class' => get_class($client),
            'params' => $client->getBuilderParams(),
        );

        // If the client was previously removed, unset the remove flag.
        unset($this->removed[$group][$name]);

        return $this;
    }
4345
public function setApiClient($api_client)
    {
        if (! class_exists($api_client) || ! method_exists($api_client, 'call')) {
            throw new DataSift_Exception_InvalidData('Class "' . $api_client . '" does not exist');
        }

        $this->_api_client = $api_client;
    }
794907
public function client($client = null)
    {
        if ($client === null) {
            return $this->getClient();
        }

        return $this->setClient($client);
    }
838568
public function setClientEncType(\Zend\Http\Client $client)
    {
        // Setting EncType to UrlEncoded
        $client->setEncType(\Zend\Http\Client::ENC_URLENCODED);

        return $client;
    }
71174
public function createClient($url = null,
        $method = \Zend\Http\Request::METHOD_GET, $timeout = null
    ) {
        $client = new \Zend\Http\Client();
        $client->setMethod($method);
        if (!empty($this->defaults)) {
            $client->setOptions($this->defaults);
        }
        if (null !== $this->defaultAdapter) {
            $client->setAdapter($this->defaultAdapter);
        }
        if (null !== $url) {
            $client->setUri($url);
        }
        if ($timeout) {
            $client->setOptions(['timeout' => $timeout]);
        }
        $this->proxify($client);
        return $client;
    }
1273868
private function resolveClient($client)
	{
		$client = ! empty($client)
			? $client
			: new Client();

		$client->setBaseUrl(Properties::baseUrl())
			->setUserAgent('Double Opt-in php-api/' . self::VERSION);

		$httpClientConfig = $this->config->getHttpClientConfig();
		if (array_key_exists('verify', $httpClientConfig)
			&& $httpClientConfig['verify'] === false)
		{
			$client->setSslVerification(false, false);
		}

		return $client;
	}
1344401
protected function setApiClient()
    {
        $apiDomain = "https://{$this->domain}";

        $client = new ApiClient(
            [
                'domain' => $apiDomain,
                'basePath' => '/',
                'guzzleOptions' => $this->guzzleOptions
            ]
        );

        $this->apiClient = $client;
    }