Proxify an existing client.

Returns the client given as argument with appropriate proxy setup.

@param \Zend\Http\Client $client  HTTP client
@param array             $options ZF2 ProxyAdapter options

@return \Zend\Http\Client
328925
public function proxify(\Zend\Http\Client $client, array $options = [])
    {
        if ($this->proxyConfig) {
            $host = $client->getUri()->getHost();
            if (!$this->isLocal($host)) {
                $proxyType =  $this->proxyConfig['proxy_type'] ?? 'default';

                if ($proxyType == 'socks5') {
                    $adapter = new \Zend\Http\Client\Adapter\Curl();
                    // Apply standard proxy options for Curl adapter:
                    $this->setCurlProxyOptions($adapter);
                    // Add SOCKS5 settings:
                    $adapter->setCurlOption(CURLOPT_FOLLOWLOCATION, true);
                    $adapter->setCurlOption(CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
                    $client->setAdapter($adapter);
                } elseif ($proxyType == 'default') {
                    // If the user has manually configured a Curl adapter,
                    // configure it for proxy compatibility; otherwise, create
                    // a fresh Proxy adapter.
                    if ($this->hasCurlAdapterAsDefault()) {
                        $adapter = new \Zend\Http\Client\Adapter\Curl();
                        $this->setCurlProxyOptions($adapter);
                    } else {
                        $adapter = new \Zend\Http\Client\Adapter\Proxy();
                        $options = array_replace($this->proxyConfig, $options);
                        $adapter->setOptions($options);
                    }
                    $client->setAdapter($adapter);
                }
            }
        }
        return $client;
    }
904536
private function _getClient(): ClientInterface
    {
        if (! $this->client instanceof ClientInterface) $this->client = new Client($this->clientConfig);
        return $this->client;
    }
838568
public function setClientEncType(\Zend\Http\Client $client)
    {
        // Setting EncType to UrlEncoded
        $client->setEncType(\Zend\Http\Client::ENC_URLENCODED);

        return $client;
    }
1013184
function $createClient(options) {
        /*
         * Ensure we have default options.
         */
        options = extend({}, {}, options);

        const { url, transport } = options;

        if (_clients[url]) {
            return _clients[url];
        }

        const client = mqtt.connect(url, transport);

        _clients[url] = client;

        return client;
    }
730480
public function client($client = null)
	{
		$client = $client ?: $this->getDefaultClient();

		// If the given driver has not been created before, we will create the instances
		// here and cache it so we can return it next time very quickly. If there is
		// already a driver created by this name, we'll just return that instance.
		if (!isset($this->routers[$client]))
		{
			$this->routers[$client] = $this->createRouter($client);
		}

		return $this->routers[$client];
	}
729509
public function addClient(\Gpupo\CommonSchema\ORM\Entity\Application\API\OAuth\Client\Client $client)
    {
        $this->clients[] = $client;

        return $this;
    }
1301523
public function setHttpClient(Client $client = null)
    {
        if ($client === null) {
            $client = new Client(
                HttpClientDiscovery::find(),
                MessageFactoryDiscovery::find()
            );
        }
        $this->client = $client;
        return $this;
    }
235561
protected function createClientOptions(ConfigRepository $config): ClientOptions
    {
        $preview               = $config->get('contentful.preview');
        $defaultLocale         = $config->get('contentful.default_locale');
        $lowMemoryResourcePool = $config->get('contentful.low_memory_resource_pool');

        $clientOptions = new ClientOptions();

        if ($preview === true) {
            $clientOptions->usingPreviewApi();
        }

        if ($defaultLocale !== null) {
            $clientOptions->withDefaultLocale($defaultLocale);
        }

        if ($lowMemoryResourcePool === true) {
            $clientOptions->withLowMemoryResourcePool();
        }

        return $clientOptions;
    }
868823
public static function customerChurnRate(array $options = [], ClientInterface $client = null)
    {
        return Metrics\CustomerChurnRates::all($options, $client);
    }
885884
public function setClient(\Yurun\Swoole\SharedMemory\Client\Client $client)
    {
        $this->client = $client;

        return $this;
    }
691751
protected function attachSubscribers(Client $client)
    {
        $client->getEmitter()->attach($this->getRetrySubscriber());
        $client->getEmitter()->attach($this->getErrorSubscriber());

        return $client;
    }
345306
public function make(array $config): Client
    {
        $config = $this->getConfig($config);

        return $this->getClient($config);
    }
553978
public static function getUserClient($organization = null, $apiKey = null, $options = [])
    {
        $baseUrl = BaseClient::DEFAULT_API_BASE_URL;

        //bc compability, when first param was $options
        if (\is_array($organization)) {
            $options = $organization;
            $organization = null;
            $apiKey = null;
        }
        if (isset($options[self::API_BASE_URL])) {
            $baseUrl = $options[self::API_BASE_URL];
        }

        $client = self::getGuzzleClient($baseUrl, $options);

        return new UserClient($client, $organization, $apiKey);
    }
468834
protected function getAdapter(Store $client, array $config)
    {
        $key = array_get($config, 'key', 'flysystem');
        $ttl = array_get($config, 'ttl');

        return new IlluminateCache($client, $key, $ttl);
    }
369284
public function create(OptionsBag $sessionOptions)
    {
        $connections = $this->parse($sessionOptions);

        $options = $this->parseOptions($sessionOptions);

        return new Predis\Client($connections, $options);
    }
1350107
public static function arpa(array $options = [], ClientInterface $client = null)
    {
        return Metrics\ARPAs::all($options, $client);
    }
1012683
public static function ltv(array $options = [], ClientInterface $client = null)
    {
        return Metrics\LTVs::all($options, $client);
    }