Configure given client

@param Client $client
327326
public static function buildCluster(Client $client)
    {
        $config = $client->getConfig();

        $consistency = constant('\Cassandra::CONSISTENCY_'.strtoupper($config['default_consistency']));

        $cluster = new Builder();
        $cluster
            ->withDefaultConsistency($consistency)
            ->withDefaultPageSize($config['default_pagesize'])
            ->withContactPoints(implode(',', $config['contact_endpoints']))
            ->withPort($config['port_endpoint'])
            ->withTokenAwareRouting($config['token_aware_routing'])
            ->withConnectTimeout($config['timeout']['connect'])
            ->withRequestTimeout($config['timeout']['request'])
            ->withPersistentSessions($config['persistent_sessions']);

        if (isset($config['ssl']) && $config['ssl'] === true) {
            $ssl = new SSLOptionsBuilder();
            $sslOption = $ssl->withVerifyFlags(\Cassandra::VERIFY_NONE)->build();
            $cluster->withSSL($sslOption);
        }

        if (array_key_exists('default_timeout', $config)) {
            $cluster->withDefaultTimeout($config['default_timeout']);
        }

        if ($config['load_balancing'] == 'round-robin') {
            $cluster->withRoundRobinLoadBalancingPolicy();
        } else {
            $dcOption = $config['dc_options'];
            $cluster->withDatacenterAwareRoundRobinLoadBalancingPolicy($dcOption['local_dc_name'], $dcOption['host_per_remote_dc'], $dcOption['remote_dc_for_local_consistency']);
        }

        if($opt = $config['contact_whitelist']) {
            !$opt['host'] ?: $cluster->withWhiteListHosts(implode(', ', $opt['host']));
            !$opt['dc'] ?: $cluster->withWhiteListDCs(implode(', ', $opt['dc']));
        }

        if($opt = $config['contact_blacklist']) {
            !$opt['host'] ?: $cluster->withBlackListHosts(implode(', ', $opt['host']));
            !$opt['dc'] ?: $cluster->withBlackListDCs(implode(', ', $opt['dc']));
        }

        if (array_key_exists('credentials', $config)) {
            $cluster->withCredentials($config['credentials']['username'], $config['credentials']['password']);
        }

        $client->setCluster($cluster->build());
    }
401812
public function changeClientPassword($client, $password)
    {
        return $this->api->changeClientPassword($this->getClientId($client), $password);
    }
487323
public function execute(Client $client)
    {
        if (!$this->request instanceof Request) {
            throw new \InvalidArgumentException('request is not an instanceof \GuzzleHttp\Message\Request');
        }

        $this->copyClientDefaults($client);

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

        return $this;
    }
141395
function configure(name, service) {
	if (!name) {
		throw new Error('Please specify a name for the client');
	}
	if (name === 'configure' || name === 'client') {
		throw new Error('Cannot register service with reserved name: ' + name);
	}
	module.exports[name] = new Client(service);
}
400343
public function refresh(Client $client)
    {
        $clientId = $client->getId();
        $this->clients[$clientId] = $client;
        $this->removeClientForRequest($clientId, $client->getPreviousRequest());

        $requestId = $client->getRequest();
        if ($requestId  !== null) {
            if (!isset($this->requests[$requestId])) {
                $this->requests[$requestId] = array();
            }
            $this->requests[$requestId][$clientId] = $client;
            $this->clientRequest[$clientId] = $requestId;
        }

        return $this;
    }
885884
public function setClient(\Yurun\Swoole\SharedMemory\Client\Client $client)
    {
        $this->client = $client;

        return $this;
    }
746310
public function bind(Client $client, ConnectionManager $cm)
    {
        $this->client = $client;
        $this->connectionManager = $cm;
        $this->bindMethods([
            'irc.sent' => 'onIrcSent',
            'irc.received' => 'onIrcReceived',
            'irc.tick' => 'onIrcTick',
            'connect.end' => 'onConnectEnd',
            'connect.error' => 'onConnectError',
            'connect.before.each' => 'onConnectBeforeEach',
            'connect.after.each'  => 'onConnectAfterEach'
        ]);
    }
1115150
protected function setClient(HttpClient $client = null)
    {
        if ($client instanceof HttpClient) {
            $this->client = $client;
        } else {
            $this->client = new HttpClient([
                'headers' => [
                    'Authorization' => "Bearer {$this->accessToken}",
                ],
            ]);
        }
    }
838568
public function setClientEncType(\Zend\Http\Client $client)
    {
        // Setting EncType to UrlEncoded
        $client->setEncType(\Zend\Http\Client::ENC_URLENCODED);

        return $client;
    }
26126
public static function configure($settings)
    {
        if (isset($settings['client_id'])) {
            self::configureOAuth($settings);
        } else {
            self::configureBasicAuth($settings);
        }
    }
253791
public function setClient($client)
    {
        if (!$client instanceof CloudFrontClient) {
            @trigger_error('The '.__METHOD__.' expects a CloudFrontClient as parameter.', E_USER_DEPRECATED);
        }

        $this->client = $client;
    }
360680
protected function configure(ClientInterface $client, array $options)
    {
        if (isset($options['exceptions'])) {
            $this->exceptions = (bool) $options['exceptions'];
        } else {
            $this->exceptions = $client->getOptions()->exceptions;
        }

        if (isset($options['cas'])) {
            $this->modeCAS = (bool) $options['cas'];
        }

        if (isset($options['watch']) && $keys = $options['watch']) {
            $this->watchKeys = $keys;
        }

        if (isset($options['retry'])) {
            $this->attempts = (int) $options['retry'];
        }
    }
1121034
public function updateClient(ClientInterface $client)
    {
        if (isset($this->clients[$client->getAccessToken()])) {
            $this->clients[$client->getAccessToken()] = $client;
        }
    }
1037649
public void setClientConfiguration(ClientConfiguration clientConfiguration) {
		this.clientConfiguration = clientConfiguration;
		if (clientConfiguration != null) {
			this.httpClientSettings = HttpClientSettings.adapt(clientConfiguration);
			if (getProvider() instanceof DefaultTokenProvider) {
				DefaultTokenProvider defaultProvider = (DefaultTokenProvider)getProvider();
				defaultProvider.setHttpClientSettings(httpClientSettings); 
			}
			if (getProvider() instanceof DelegateTokenProvider) {
				DelegateTokenProvider delegateProvider = (DelegateTokenProvider)getProvider();
				delegateProvider.setHttpClientSettings(httpClientSettings); 
			}
		}
	}
1049906
public function create(ClientInterface $client): ClientInterface
    {
        try {
            $now    = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $schema = $this->getDatabaseSchema();
            $values = [
                $schema->getClientsIdentityColumn()               => $client->getIdentifier(),
                $schema->getClientsNameColumn()                   => $client->getName(),
                $schema->getClientsDescriptionColumn()            => $client->getDescription(),
                $schema->getClientsCredentialsColumn()            => $client->getCredentials(),
                $schema->getClientsIsConfidentialColumn()         => $client->isConfidential(),
                $schema->getClientsIsScopeExcessAllowedColumn()   => $client->isScopeExcessAllowed(),
                $schema->getClientsIsUseDefaultScopeColumn()      => $client->isUseDefaultScopesOnEmptyRequest(),
                $schema->getClientsIsCodeGrantEnabledColumn()     => $client->isCodeGrantEnabled(),
                $schema->getClientsIsImplicitGrantEnabledColumn() => $client->isImplicitGrantEnabled(),
                $schema->getClientsIsPasswordGrantEnabledColumn() => $client->isPasswordGrantEnabled(),
                $schema->getClientsIsClientGrantEnabledColumn()   => $client->isClientGrantEnabled(),
                $schema->getClientsIsRefreshGrantEnabledColumn()  => $client->isRefreshGrantEnabled(),
                $schema->getClientsCreatedAtColumn()              => $now,
            ];

            $identifier = $client->getIdentifier();
            if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) {
                $this->createResource($values);
            } else {
                $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) {
                    $this->createResource($values);
                    $this->bindScopeIdentifiers($identifier, $scopeIdentifiers);
                });
            }
            $client->setCreatedAt($now);

            return $client;
        } catch (RepositoryException $exception) {
            $message = 'Client creation failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
922266
private function configureClients(ContainerBuilder $container, array $config)
    {
        $first = null;
        $clients = [];

        foreach ($config['clients'] as $name => $arguments) {
            if (null === $first) {
                // Save the name of the first configured client.
                $first = $name;
            }

            $this->configureClient($container, $name, $arguments);
            $clients[] = $name;
        }

        // If we have clients configured
        if (null !== $first) {
            // If we do not have a client named 'default'
            if (!array_key_exists('default', $config['clients'])) {
                $serviceId = 'httplug.client.'.$first;
                // Alias the first client to httplug.client.default
                $container->setAlias('httplug.client.default', $serviceId);
                $default = $first;
            } else {
                $default = 'default';
                $serviceId = 'httplug.client.'.$default;
            }

            // Autowiring alias for special clients, if they are enabled on the default client
            if ($config['clients'][$default]['flexible_client']) {
                $container->setAlias(FlexibleHttpClient::class, $serviceId.'.flexible');
            }
            if ($config['clients'][$default]['http_methods_client']) {
                if (\interface_exists(HttpMethodsClientInterface::class)) {
                    // support for client-common 1.9
                    $container->setAlias(HttpMethodsClientInterface::class, $serviceId.'.http_methods');
                }
            }
            if ($config['clients'][$default]['batch_client']) {
                if (\interface_exists(BatchClientInterface::class)) {
                    // support for client-common 1.9
                    $container->setAlias(BatchClientInterface::class, $serviceId.'.batch_client');
                }
            }
        }
    }