protected function loadInternal(array $config, ContainerBuilder $container)
    {
        $locator = new FileLocator(__DIR__.'/../Resources/config');
        $loader = new PhpFileLoader($container, $locator);
        $loader->load('services.php');

        $container->registerForAutoconfiguration(LoaderInterface::class)
            ->setPrivate(true)
            ->addTag('ruwork_runet_id.basket_loader');

        $container->registerForAutoconfiguration(HandlerInterface::class)
            ->setPrivate(true)
            ->addTag('ruwork_runet_id.basket_handler');

        $clientReferences = [];

        foreach ($config['clients'] as $name => $clientConfig) {
            $clientReferences[$name] = $this->registerClient($container, $name, $clientConfig);
        }

        $clientAlias = new Alias('ruwork_runet_id.client.'.$config['default_client'], false);
        $container->setAlias(RunetIdClient::class, $clientAlias);
        $container->setAlias('ruwork_runet_id.client._default', $clientAlias);

        if (class_exists(HWIOAuthBundle::class)) {
            foreach ($clientReferences as $name => $reference) {
                $container
                    ->register('ruwork_runet_id.oauth.'.$name, ResourceOwner::class)
                    ->setPublic(false)
                    ->setArgument('$client', $reference);
            }

            $oauthAlias = new Alias('ruwork_runet_id.oauth.'.$config['default_client'], false);
            $container->setAlias('ruwork_runet_id.oauth._default', $oauthAlias);
        }

        $container
            ->findDefinition(RunetIdClients::class)
            ->setArguments([
                '$container' => ServiceLocatorTagPass::register($container, $clientReferences),
                '$defaultName' => $config['default_client'],
            ]);

        if (!class_exists(Validation::class)) {
            $container->removeDefinition('ruwork_runet_id.validator.unique_email');
        }
    }
protected function loadInternal(array $config, ContainerBuilder $container)
    {
        $locator = new FileLocator(__DIR__.'/../Resources/config');
        $loader = new PhpFileLoader($container, $locator);
        $loader->load('services.php');

        $container->registerForAutoconfiguration(LoaderInterface::class)
            ->setPrivate(true)
            ->addTag('ruwork_runet_id.basket_loader');

        $container->registerForAutoconfiguration(HandlerInterface::class)
            ->setPrivate(true)
            ->addTag('ruwork_runet_id.basket_handler');

        $clientReferences = [];

        foreach ($config['clients'] as $name => $clientConfig) {
            $clientReferences[$name] = $this->registerClient($container, $name, $clientConfig);
        }

        $clientAlias = new Alias('ruwork_runet_id.client.'.$config['default_client'], false);
        $container->setAlias(RunetIdClient::class, $clientAlias);
        $container->setAlias('ruwork_runet_id.client._default', $clientAlias);

        if (class_exists(HWIOAuthBundle::class)) {
            foreach ($clientReferences as $name => $reference) {
                $container
                    ->register('ruwork_runet_id.oauth.'.$name, ResourceOwner::class)
                    ->setPublic(false)
                    ->setArgument('$client', $reference);
            }

            $oauthAlias = new Alias('ruwork_runet_id.oauth.'.$config['default_client'], false);
            $container->setAlias('ruwork_runet_id.oauth._default', $oauthAlias);
        }

        $container
            ->findDefinition(RunetIdClients::class)
            ->setArguments([
                '$container' => ServiceLocatorTagPass::register($container, $clientReferences),
                '$defaultName' => $config['default_client'],
            ]);

        if (!class_exists(Validation::class)) {
            $container->removeDefinition('ruwork_runet_id.validator.unique_email');
        }
    }
{@inheritdoc}