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');
                }
            }
        }
    }