Add a client to the pool.

@param ClientInterface|HttpAsyncClient|HttpClientPoolItem $client
962622
public function addHttpClient($client): void
    {
        if (!$client instanceof HttpClientPoolItem) {
            $client = new HttpClientPoolItem($client);
        }

        $this->clientPool[] = $client;
    }
393697
def connect(self, client: BasicClient, *args, **kwargs):
        
        self.clients.add(client)
        self.connect_args[client] = (args, kwargs)
        # hack the clients event loop to use the pools own event loop
        client.eventloop = self.eventloop
15933
public function addCache(CacheItemPoolInterface $cachePool, array $config = [])
    {
        $this->setCachePlugin($cachePool, $config['generator'] ?? null, $config['lifetime'] ?? null);

        $this->setPropertyValue('httpClientModified', true);
    }
1231530
public function registerPlayer(Client $client, Chips $buyinAmount = null)
    {
        $buyinAmount = $buyinAmount ?? $this->minimumBuyIn();

        $playersWithTheSameName = $this->players()
            ->filter(function (Client $player) use ($client) {
                return $client->name() === $player->name();
            });

        if ($playersWithTheSameName->count() !== 0) {
            throw GameException::alreadyRegistered($client, $this);
        }

        if ($buyinAmount->amount() > $client->wallet()->amount()) {
            throw GameException::insufficientFunds($client, $this);
        }

        $client->wallet()->subtract($buyinAmount);

        $addPlayer = Player::fromClient($client, $buyinAmount);
        $this->players()->push($addPlayer);
    }
1115150
protected function setClient(HttpClient $client = null)
    {
        if ($client instanceof HttpClient) {
            $this->client = $client;
        } else {
            $this->client = new HttpClient([
                'headers' => [
                    'Authorization' => "Bearer {$this->accessToken}",
                ],
            ]);
        }
    }
1328476
protected function bindClientEvents(PoolClientInterface $client)
    {
        $clientId = $client->getClientId();
        $this->_clientsStates[$clientId] = PoolClientInterface::CLIENT_POOL_STATE_READY;
        $this->_clientsQueueCounters[$clientId] = 0;

        //Remove client from pool on close
        $client->once(PoolClientInterface::CLIENT_POOL_EVENT_CLOSE, function() use ($client, $clientId) {
            unset($this->_clients[$clientId]);
            unset($this->_clientsStates[$clientId]);
            unset($this->_clientsQueueCounters[$clientId]);
            $client->removeAllListeners(PoolClientInterface::CLIENT_POOL_EVENT_CHANGE_STATE);
            $client->removeAllListeners(PoolClientInterface::CLIENT_POOL_EVENT_CHANGE_QUEUE);
        });
        //Change client state
        $client->on(PoolClientInterface::CLIENT_POOL_EVENT_CHANGE_STATE, function($state) use ($client, $clientId) {
            $this->_clientsStates[$clientId] = $state;
        });
        //Change client queue count
        $client->on(PoolClientInterface::CLIENT_POOL_EVENT_CHANGE_QUEUE, function($queueCount) use ($client, $clientId) {
            $this->_clientsQueueCounters[$clientId] = $queueCount;
        });
    }
596007
protected function createClient($client)
    {
        try {
            new \ReflectionClass($client);
        } catch (\ReflectionException $e) {
            throw new FoundationException(sprintf("Could not load class '%s'.", $client), null, $e);
        }

        $client_instance = new $client();

        return $client_instance;
    }
939469
public function updateClient(Client $client)
    {
        ValidationUtility::ensureNotNull('$client->getClientId()', $client->getClientId());

        return $this->callServicePostApi(
            '\Authlete\Dto\Client::fromJson',
            self::$CLIENT_UPDATE_API_PATH . $client->getClientId(),
            null, $client);
    }
836503
public function setClient(AbstractClient $client)
    {
        if (false === $client instanceof Svn) {
            throw new \InvalidArgumentException(sprintf('Expected argument $client to be Webcreate\Vcs\Svn instead %s given.', get_class($client)));
        }

        $this->client = $client;

        return $this;
    }
1135313
public function client($client)
    {
        $this->client = $client instanceof Client ? $client : bearychat($client);

        if ($this->message) {
            $this->message->setClient($this->client);
        }

        return $this;
    }
666061
public function setClient(MemcacheClient $client) {
		$this->memcacheClient        = $client;
		$this->connectionCheckStatus = (@$client->getStats() !== false);
	}
71749
private function addClients(array $pools, ContainerBuilder $container)
    {
        foreach ($pools as $pool => $memcacheConfig) {
            $this->newMemcacheClient($pool, $memcacheConfig, $container);
        }
    }
651113
public static function setKey($key, ClientInterface $client = null)
	{
		self::$api = new Api($key, $client);

		return self::$api;
	}
1222250
public function addClient($client, RequestMatcher $requestMatcher): void
    {
        $this->clients[] = [
            'matcher' => $requestMatcher,
            'client' => new FlexibleHttpClient($client),
        ];
    }
1152421
def add(channel, client)
      @lock.synchronize do
        _remove(client) if @clients.include? client and @clients[client] != channel
        debug { "Adding #{client} to #{channel}." }
        @clients[client] = channel
        @channels[channel] = @channels[channel] ? @channels[channel] + 1 : 1
      end
    end
175847
public static function all(array $data = [], ClientInterface $client = null)
    {

        return (new RequestService($client))
            ->setResourceClass(static::class)
            ->all($data);
    }
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);
    }