Loads the configuration.

@param array            $configs   An array of configurations
@param ContainerBuilder $container A ContainerBuilder instance

@throws InvalidConfigurationException
187162
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('redis.xml');

        $mainConfig = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($mainConfig, $configs);

        foreach ($config['class'] as $name => $class) {
            $container->setParameter(sprintf('snc_redis.%s.class', $name), $class);
        }

        foreach ($config['clients'] as $client) {
            $this->loadClient($client, $container);
        }

        if (isset($config['session'])) {
            $this->loadSession($config, $container, $loader);
        }

        if (isset($config['doctrine']) && count($config['doctrine'])) {
            $this->loadDoctrine($config, $container);
        }

        if (isset($config['monolog'])) {
            if (!empty($config['clients'][$config['monolog']['client']]['logging'])) {
                throw new InvalidConfigurationException(sprintf('You have to disable logging for the client "%s" that you have configured under "snc_redis.monolog.client"', $config['monolog']['client']));
            }
            $this->loadMonolog($config, $container);
        }

        if (isset($config['swiftmailer'])) {
            $this->loadSwiftMailer($config, $container);
        }

        if (isset($config['profiler_storage'])) {
            $this->loadProfilerStorage($config, $container, $loader);
        }
    }
526225
public function load(array $configs, ContainerBuilder $container)
    {
        $configs = (new Processor)->processConfiguration(new Configuration(), $configs);

        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.yml');
        $loader->load('twig_extensions.yml');
        $loader->load('form_types.yml');
        $loader->load('ref_id_providers.yml');

        if (extension_loaded("redis")) {
            $container->setParameter('kunstmaan_extra.redis_host', $configs['redis']['host']);
            $container->setParameter('kunstmaan_extra.redis_port', $configs['redis']['port']);
            $container->setParameter('kunstmaan_extra.redis_password', $configs['redis']['password']);
            $loader->load('redis_services.yml');
        }

        $container->setParameter('kunstmaan_extra.bem', $configs['bem']);

        $container->setParameter('kunstmaan_node_search.search_configuration.node.class', KunstmaanExtraNodePagesConfiguration::class);
        $container->setParameter('kunstmaan_search.search.class', ChainSearchProvider::class);

        if ($configs['search']['url']) {
            $container->setParameter(CompilerPass\ElasticSearchCompilerPass::PARAM_SEARCH_URL, $configs['search']['url']);
        }

        $container->setParameter('kunstmaan_extra.search.replicas', $configs['search']['replicas']);
        $container->setParameter('kunstmaan_extra.search.shards', $configs['search']['shards']);

        $container->setParameter('kunstmaan_extra.date_formats', isset($configs['date_formats']) ? $configs['date_formats'] : []);

        if ($configs['assets']['web_prefix']) {
            $container->setParameter('kunstmaan_extra.assets.cdn_url', $configs['assets']['cdn_url']);
            $container->setParameter('kunstmaan_extra.assets.web_prefix', $configs['assets']['web_prefix']);
            $loader->load('assets.yml');
        }

        if ($configs['tinypng_api_key']) {
            $container->setParameter('kunstmaan_extra.tinypng_api_key', $configs['tinypng_api_key']);
            $loader->load('imagine_tinypng_services.yml');
        }

        if ($configs['imgix']['bucket']) {
            $container->setParameter('kunstmaan_extra.imgix_bucket', $configs['imgix']['bucket']);
            $container->setParameter('kunstmaan_extra.imgix_presets', $configs['imgix']['presets']);
            $loader->load('imagine_imgix_services.yml');
        }

        $container->setParameter('kunstmaan_extra.typography.orphans', $configs['typography']['orphans']);

        if ($configs['generate_controller']) {
            $container->setDefinition('kunstmaan_extra.typehinting_controller_cache_warmer', (new Definition)
                ->setClass(TypehintingControllerCacheWarmer::class)
                ->setArguments([new Reference('kernel'), $configs['generate_controller']])
                ->addTag('kernel.cache_warmer')
            );
        }
    }
1353242
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();

        $reflectionObject = new \ReflectionObject($this);
        $loader = new Loader\XmlFileLoader($container, new FileLocator(dirname($reflectionObject->getFileName()).'/../Resources/config'));

        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $parameterBuilder = new ParameterBuilder($container);
        $parameterBuilder->build(Constants::ROOT_PARAMETER, $config);

        $this->loadXmlServices($loader);

        if (Driver::BOTH === $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver')) {
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_orm', true);
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_odm', true);

            $loader->load('orm.xml');
            $loader->load('odm.xml');
        } else {
            $driver = $container->getParameter(Constants::ROOT_PARAMETER.'.admin.driver');
            $container->setParameter(Constants::ROOT_PARAMETER.'.admin.backend_type_'.$driver, true);

            $loader->load($driver.'.xml');
        }
    }
1258555
public function load(array $configs, ContainerBuilder $container): void
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.yml');

        // If the search bundle is active register search services.
        $bundles = $container->getParameter('kernel.bundles');
        if (isset($bundles['BkstgSearchBundle'])) {
            $loader->load('services.search.yml');
        }
        $this->configureFilesystemAdapter($container, $config);
        $this->configureCdnAdapter($container, $config);
    }
666661
public function load(array $config, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(new Configuration(), $config);

        $provider = $config['provider'];
        $container->setParameter(
            'openclassrooms.cache.default_lifetime',
            $config['default_lifetime']
        );

        $container->setParameter(
            'openclassrooms.cache.cache_provider_type',
            key($provider)
        );

        switch (key($provider)) {
            case CacheProviderType::REDIS:
                $providerConfig = $provider[CacheProviderType::REDIS];
                $container->setParameter('openclassrooms.cache.provider_host', $providerConfig['host']);
                $container->setParameter('openclassrooms.cache.provider_port', $providerConfig['port']);
                $container->setParameter('openclassrooms.cache.provider_timeout', $providerConfig['timeout']);
                break;
            default;
                break;
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config/'));
        $loader->load('services.xml');
    }
724208
public function load(array $config, ContainerBuilder $container)
    {
        $container->addObjectResource($this);

        $configuration = $this->getConfiguration($config, $container);
        if ($configuration instanceof ConfigurationInterface) {
            $config = $this->processConfiguration($configuration, $config);
            $this->applyParametrizedValues($config, $container);
        }

        $configFiles = $this->getConfigFiles($config);
        if (!empty($configFiles)) {
            $this->loadFiles($configFiles, $container);
        }

        $this->postLoad($config, $container);
    }
1012961
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new FlowConfiguration();
        $processor = new Processor();
        $this->flowsConfig = $processor->processConfiguration($configuration, $configs);
    }
1360881
public function load(array $configs, ContainerBuilder $container)
    {
        $this->container = $container;
        $this->kernelRootDir = $container->getParameterBag()->get("kernel.root_dir");

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $this->setInitialParams();
        if (isset($config["android"])) {
            $this->setAndroidConfig($config);
            $loader->load('android.xml');
        }
        if (isset($config["ios"])) {
            $this->setiOSConfig($config);
            $loader->load('ios.xml');
        }
        if (isset($config["mac"])) {
            $this->setMacConfig($config);
            $loader->load('mac.xml');
        }
        if (isset($config["blackberry"])) {
            $this->setBlackberryConfig($config);
            $loader->load('blackberry.xml');
        }
        if (isset($config['windowsphone'])) {
            $this->setWindowsphoneConfig($config);
            $loader->load('windowsphone.xml');
        }
    }
75723
public function load(array $configs, ContainerBuilder $container): void
    {
        $configuration = new Req2CmdConfiguration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

        $loader->load('actions.xml');
        $loader->load('extractors.xml');
        $loader->load('listeners.xml');
        $loader->load('param_mappers.xml');
        $loader->load('command_bus.xml');
        $loader->load('serializer.xml');

        $this->configureExtractors($config, $container);
        $this->configureCommandBus($config, $container);
        $this->configureEventListeners($config, $container);
    }
362132
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.xml');

        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $this->registerCommandConfiguration($config, $container);
        $this->registerGeneratorConfiguration($config, $container);

        $container->registerForAutoconfiguration(GeneratorInterface::class)
            ->setLazy(true)
            ->addTag('mbt.generator');
        $container->registerForAutoconfiguration(PathReducerInterface::class)
            ->setLazy(true)
            ->addTag('mbt.path_reducer');
        $container->registerForAutoconfiguration(SubjectInterface::class)
            ->setLazy(true)
            ->addTag('mbt.subject');
    }
712938
public function load(array $configs, ContainerBuilder $builder)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($builder, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yaml');
        $loader->load('services/factories.yaml');
        $loader->load('services/fields.yaml');
        $loader->load('services/resources.yaml');
        $loader->load('services/subscribers.yaml');
        $loader->load('services/twig.yaml');

        if ('dev' === $builder->getParameter('kernel.environment')) {
            $loader->load('services_dev.yaml');
        }
        $applicationConfig = [];
        $adminsConfig = [];
        $menusConfig = [];
        $enableExtraConfig = true;

        if (key_exists('application', $config)) {
            if (key_exists('enable_extra_configuration', $config['application'])) {
                $enableExtraConfig = $config['application']['enable_extra_configuration'];
            }
            $applicationConfig = $config['application'];
        }

        if (key_exists('admins', $config)) {
            $adminsConfig = $config['admins'];
        }

        if (key_exists('menus', $config)) {
            $menusConfig = $config['menus'];

            foreach ($menusConfig as $name => $menu) {
                if (null === $menu) {
                    $menusConfig[$name] = [];
                }
            }
        }
        $builder->setParameter('lag.admin.enable_extra_configuration', $enableExtraConfig);
        $builder->setParameter('lag.admin.application_configuration', $applicationConfig);
        $builder->setParameter('lag.admins', $adminsConfig);
        $builder->setParameter('lag.menus', $menusConfig);
    }
1342903
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();
        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        $httpClient = $config['http_client'];
        $httpClientOptions = $config['http_client_options'];
        $clientConfigurations = $config['clients'];

        $clientServiceKeys = [];
        foreach ($clientConfigurations as $key => $clientConfig) {
            // manually make sure "type" is there
            if (!isset($clientConfig['type'])) {
                throw new InvalidConfigurationException(sprintf(
                    'Your "knpu_oauth2_client.clients.%s" config entry is missing the "type" key.',
                    $key
                ));
            }

            $type = $clientConfig['type'];
            unset($clientConfig['type']);
            if (!isset(self::$supportedProviderTypes[$type])) {
                throw new InvalidConfigurationException(sprintf(
                    'The "knpu_oauth2_client.clients" config "type" key "%s" is not supported. We support (%s)',
                    $type,
                    implode(', ', self::$supportedProviderTypes)
                ));
            }

            // process the configuration
            $tree = new TreeBuilder('knpu_oauth2_client/clients/' . $key);
            $node = method_exists($tree, 'getRootNode')
                ? $tree->getRootNode()
                : $tree->root('knpu_oauth2_client/clients/' . $key);

            $this->buildConfigurationForType($node, $type);
            $processor = new Processor();
            $config = $processor->process($tree->buildTree(), [$clientConfig]);

            $configurator = $this->getConfigurator($type);

            $providerOptions = $configurator->getProviderOptions($config);

            $collaborators = [];
            if ($httpClient) {
                $collaborators['httpClient'] = new Reference($httpClient);
            } else {
                $providerOptions = array_merge($providerOptions, $httpClientOptions);
            }
            // hey, we should add the provider/client service!
            $clientServiceKey = $this->configureProviderAndClient(
                $container,
                $type,
                $key,
                $configurator->getProviderClass($config),
                $configurator->getClientClass($config),
                $configurator->getPackagistName(),
                $providerOptions,
                $config['redirect_route'],
                $config['redirect_params'],
                $config['use_state'],
                $collaborators
            );

            $clientServiceKeys[$key] = $clientServiceKey;
        }

        $container->getDefinition('knpu.oauth2.registry')
            ->replaceArgument(1, $clientServiceKeys);
    }
18290
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->register('templating', 'Symfony\Component\Templating\DelegatingEngine');
        $container->register('templating.template_name_parser', 'Symfony\Component\Templating\TemplateNameParser');

        if (true === $config['enable_php_engine']) {
            $container->setParameter('php.template_dir', $config['template_dir']);

            $container->register('templating.engine.php.loader', 'Symfony\Component\Templating\Loader\FilesystemLoader')
                ->setPublic(false)
                ->addArgument('%php.template_dir%/%%name%%');
            $container->register('templating.engine.php.helper.slots', 'Symfony\Component\Templating\Helper\SlotsHelper');
            $container->register('templating.engine.php.helper.assets', 'Nice\Templating\Helper\AssetsHelper')
                ->addArgument(new Reference('service_container'));
            $container->register('templating.engine.php.helper.router', 'Nice\Templating\Helper\RouterHelper')
                ->addArgument(new Reference('service_container'));
            $container->register('templating.engine.php', 'Symfony\Component\Templating\PhpEngine')
                ->addArgument(new Reference('templating.template_name_parser'))
                ->addArgument(new Reference('templating.engine.php.loader'))
                ->addMethodCall('set', array(new Reference('templating.engine.php.helper.slots')))
                ->addMethodCall('set', array(new Reference('templating.engine.php.helper.assets')))
                ->addMethodCall('set', array(new Reference('templating.engine.php.helper.router')))
                ->addTag('templating.engine');
        }
    }
769095
protected function loadRepository($loader, ContainerBuilder $container, array $config)
    {
        if (isset($config['repository']['type'])) {
            if ($config['repository']['type'] == 'yaml') {
                if (!isset($config['repository']['repo']['filename'])) {
                    throw new InvalidConfigurationException(
                        'You must define filename parameter for repo yaml repository'
                    );
                }
                $container->setParameter(
                    'snide_travinizer.repo_repository.filename',
                    $config['repository']['repo']['filename']
                );
            }

            $loader->load('repository/' . strtr($config['repository']['type'], '_', '/') . '.xml');
        } else {
            throw new InvalidConfigurationException('You must define repository type parameter');
        }

        if (isset($config['repository']['class'])) {
            $container->setParameter('snide_travinizer.repo_repository.class', $config['repository']['class']);
        }
    }
1359048
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration($container->getParameter('kernel.debug'));
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('view.xml');
        $loader->load('routing.xml');
        $loader->load('request.xml');
        $loader->load('serializer.xml');

        $container->getDefinition('fos_rest.routing.loader.controller')->replaceArgument(4, $config['routing_loader']['default_format']);
        $container->getDefinition('fos_rest.routing.loader.yaml_collection')->replaceArgument(4, $config['routing_loader']['default_format']);
        $container->getDefinition('fos_rest.routing.loader.xml_collection')->replaceArgument(4, $config['routing_loader']['default_format']);

        $container->getDefinition('fos_rest.routing.loader.yaml_collection')->replaceArgument(2, $config['routing_loader']['include_format']);
        $container->getDefinition('fos_rest.routing.loader.xml_collection')->replaceArgument(2, $config['routing_loader']['include_format']);
        $container->getDefinition('fos_rest.routing.loader.reader.action')->replaceArgument(3, $config['routing_loader']['include_format']);
        $container->getDefinition('fos_rest.routing.loader.reader.action')->replaceArgument(5, $config['routing_loader']['prefix_methods']);

        foreach ($config['service'] as $key => $service) {
            if ('validator' === $service && empty($config['body_converter']['validate'])) {
                continue;
            }

            if (null !== $service) {
                if ('view_handler' === $key) {
                    $container->setAlias('fos_rest.'.$key, new Alias($service, true));
                } else {
                    $container->setAlias('fos_rest.'.$key, $service);
                }
            }
        }

        $this->loadForm($config, $loader, $container);
        $this->loadException($config, $loader, $container);
        $this->loadBodyConverter($config, $loader, $container);
        $this->loadView($config, $loader, $container);

        $this->loadBodyListener($config, $loader, $container);
        $this->loadFormatListener($config, $loader, $container);
        $this->loadVersioning($config, $loader, $container);
        $this->loadParamFetcherListener($config, $loader, $container);
        $this->loadAllowedMethodsListener($config, $loader, $container);
        $this->loadAccessDeniedListener($config, $loader, $container);
        $this->loadZoneMatcherListener($config, $loader, $container);

        // Needs RequestBodyParamConverter and View Handler loaded.
        $this->loadSerializer($config, $container);
    }
798670
public function load(ContainerBuilder $container, array $config)
    {
        $this->loadPauser($container);
        $this->loadController($container);
        $this->loadListener($container);
    }
765017
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->register('doctrine.dbal.configuration', 'Doctrine\DBAL\Configuration');

        $container->register('doctrine.dbal.database_connection', 'Doctrine\DBAL\Connection')
            ->setFactoryClass('Doctrine\DBAL\DriverManager')
            ->setFactoryMethod('getConnection')
            ->addArgument($config['database'])
            ->addArgument(new Reference('doctrine.dbal.configuration'));
    }