Loads a specific configuration.

@param array $config An array of configuration values
@param ContainerBuilder $container A ContainerBuilder instance

@throws \InvalidArgumentException When provided tag is not defined in this extension
431013
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

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

        $container->setParameter('ecommit_util.clear_apcu.url', $config['clear_apcu']['url']);
        $container->setParameter('ecommit_util.clear_apcu.username', $config['clear_apcu']['username']);
        $container->setParameter('ecommit_util.clear_apcu.password', $config['clear_apcu']['password']);

        $container->setParameter('ecommit_util.install_lock_file', $config['install_lock_file']);

        foreach ($config['cache'] as $name => $options) {
            $serviceName = sprintf('ecommit_cache_%s', $name);
            $container
                ->setDefinition($serviceName, new ChildDefinition('ecommit_util.cache'))
                ->replaceArgument(0, $options)
                ->setPublic(true);
        }
    }
476393
public function load(array $configs, ContainerBuilder $container)
    {
        // Set Fragment Cache disabled by default
        if (!$container->hasParameter('andres_montanez_fragment_cache.enabled')) {
            $container->setParameter('andres_montanez_fragment_cache.enabled', false);
        }

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.yml');
    }
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');
        }
    }
91636
private function configureStorage(array $config, ContainerBuilder $container)
    {
        $container->register('doctrine.key_value.storage', 'Doctrine\KeyValueStore\Storage\DoctrineCacheStorage')
            ->setPublic(false)
            ->addArgument(new Reference('cache.' . $config['cache_driver']));
    }
435502
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

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

        if ($config['toolbar'] || $config['intercept_redirects']) {
            $loader->load('toolbar.xml');
            $container->getDefinition('web_profiler.debug_toolbar')->replaceArgument(4, $config['excluded_ajax_paths']);
            $container->setParameter('web_profiler.debug_toolbar.intercept_redirects', $config['intercept_redirects']);
            $container->setParameter('web_profiler.debug_toolbar.mode', $config['toolbar'] ? WebDebugToolbarListener::ENABLED : WebDebugToolbarListener::DISABLED);
        }

        if (Kernel::VERSION_ID >= 40008 || (Kernel::VERSION_ID >= 30408 && Kernel::VERSION_ID < 40000)) {
            $container->getDefinition('debug.file_link_formatter')
                ->replaceArgument(3, new ServiceClosureArgument(new Reference('debug.file_link_formatter.url_format')));
        }
    }
709655
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('menu.xml');

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

        foreach ($config['providers'] as $builder => $enabled) {
            if ($enabled) {
                $container->getDefinition(sprintf('knp_menu.menu_provider.%s', $builder))->addTag('knp_menu.provider');
            }
        }

        if (isset($config['twig'])) {
            $loader->load('twig.xml');
            $container->setParameter('knp_menu.renderer.twig.template', $config['twig']['template']);
        }
        if ($config['templating']) {
            $loader->load('templating.xml');
        }

        $container->setParameter('knp_menu.default_renderer', $config['default_renderer']);

        // Register autoconfiguration rules for Symfony DI 3.3+
        if (method_exists($container, 'registerForAutoconfiguration')) {
            $container->registerForAutoconfiguration(VoterInterface::class)
                ->addTag('knp_menu.voter');
        }
    }
190458
public function load(ContainerBuilder $container, array $config) {
        // Client initializer definition
        $clientInitializerDefinition = new Definition(
            ApiClientAwareInitializer::class,
            [
                $config['apiClient']
            ]
        );
        $clientInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Definition for the array contains comparator
        $comparatorDefinition = new Definition(ArrayContainsComparator::class);

        // Comparator initializer definition
        $comparatorInitializerDefinition = new Definition(
            ArrayContainsComparatorAwareInitializer::class,
            [
                new Reference(self::COMPARATOR_SERVICE_ID)
            ]
        );
        $comparatorInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Add all definitions to the container
        $container->setDefinition(self::APICLIENT_INITIALIZER_SERVICE_ID, $clientInitializerDefinition);
        $container->setDefinition(self::COMPARATOR_SERVICE_ID, $comparatorDefinition);
        $container->setDefinition(self::COMPARATOR_INITIALIZER_SERVICE_ID, $comparatorInitializerDefinition);
    }
220317
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $processedConfiguration = $this->processConfiguration($configuration, $configs);
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        $this->passConfigurationToOptions($container, $processedConfiguration);

        $container->getDefinition(ClientBuilderInterface::class)
            ->setConfigurator([ClientBuilderConfigurator::class, 'configure']);

        foreach ($processedConfiguration['listener_priorities'] as $key => $priority) {
            $container->setParameter('sentry.listener_priorities.' . $key, $priority);
        }

        $this->tagConsoleErrorListener($container);
    }
597870
protected function loadInternal(
        array $mergedConfig,
        ContainerBuilder $container
    )
    {
        /**
         * Setting defined parameters to services
         */
        $container->setParameter('twitter.api_key',
            $mergedConfig['twitter']['api_key']
        );

        $container->setParameter('twitter.api_secret',
            $mergedConfig['twitter']['api_secret']
        );

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

        $loader->load('services.yml');
    }
455795
public function load(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $config);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('container.yml');
        $loader->load('own.yml');
        $loader->load('system.yml');
        $loader->load('party.yml');
        $loader->load('store.yml');
        $loader->load('credential.yml');
        $loader->load('service.yml');
        $loader->load('provider.yml');
        $loader->load('profile.yml');

        $this->configureOwn($container, $config);
        $this->configureSystem($container, $config);
        $this->configureParty($container, $config);
        $this->configureStore($container, $config);
        $this->configureCredential($container, $config);
        $this->configureService($container, $config);
    }
465405
public function load(array $config, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/services'));
        $loader->load('montserrat.xml');

        if (isset($config['working_dir'])) {
            $container->setParameter('behat.montserrat.working_dir', $config['working_dir']);
        }

        if (isset($config['prepend_paths'])) {
            $parameterBag = $container->getParameterBag();
            $paths = array();
            foreach ($config['prepend_paths'] as $p) {
                $paths[] = $parameterBag->resolveValue($p); 
            }
            $container->setParameter('behat.montserrat.prepend_path', implode(PATH_SEPARATOR, $paths));
        }
    }
162558
public function load(ContainerBuilder $container, array $config)
    {
        $container->setParameter('cjm.local_webserver.configuration.host', $config['host']);
        $container->setParameter('cjm.local_webserver.configuration.port', $config['port']);
        $container->setParameter('cjm.local_webserver.configuration.docroot', $config['docroot']);
        $container->setParameter('cjm.local_webserver.configuration.suites', $config['suites']);
        $container->setParameter('cjm.local_webserver.configuration.router', $config['router']);

        $this->loadEventSubscribers($container);
        $this->loadWebserverController($container);
        $this->loadWebserverConfiguration($container, $config);
    }
258765
public function load(array $configs, ContainerBuilder $container)
    {
        // Parse configuration
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

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

        // Toolbar
        $loader->load('toolbar.xml');
        if ($config['toolbar'] === 'demo') {
            $mode = ToolbarListener::DEMO;
        }
        else if ($config['toolbar']) {
            $mode = ToolbarListener::ENABLED;
        }
        else {
            $mode = ToolbarListener::DISABLED;
        }

        // Other Services
        $loader->load('services.xml');

        // Set parameter
        $container->setParameter('terrific_composer.toolbar.mode', $mode);
        $container->setParameter('terrific_composer.composition.bundles', $config['composition_bundles']);
        $container->setParameter('terrific_composer.module.layout', $config['module_layout']);
        $container->setParameter('terrific_composer.module.template', $config['module_template']);
    }
23689
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

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

        $this->registerWorkflowConfiguration($config['workflows'], $container, $loader);
    }
692235
public function load(ContainerBuilder $container, array $config)
    {
        $definition = new Definition('jarnaiz\\JUnitFormatter\\Formatter\\JUnitFormatter');

        if (!$filename = \getenv(self::ENV_FILENAME)) {
            $filename = $config['filename'];
        }

        if (!$outputDir = \getenv(self::ENV_OUTPUTDIR)) {
            $outputDir = $config['outputDir'];
        }

        $definition->addArgument($filename);
        $definition->addArgument($outputDir);

        $container->setDefinition('junit.formatter', $definition)
            ->addTag('output.formatter');
    }
465013
protected function loadConfiguration(ContainerBuilder $container)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . "/../Config/Resources"));
        $finder = Finder::create()
            ->name('*.xml')
            ->depth(0)
            ->in(__DIR__ . "/../Config/Resources");

        /** @var \SplFileInfo $file */
        foreach ($finder as $file) {
            $loader->load($file->getBaseName());
        }

        if (\defined("THELIA_INSTALL_MODE") === false) {
            $modules = ModuleQuery::getActivated();

            $translationDirs = array();



            /** @var Module $module */
            foreach ($modules as $module) {
                try {
                    $definition = new Definition();
                    $definition->setClass($module->getFullNamespace());
                    $definition->addMethodCall("setContainer", array(new Reference('service_container')));

                    $container->setDefinition(
                        "module." . $module->getCode(),
                        $definition
                    );

                    $compilers = \call_user_func(array($module->getFullNamespace(), 'getCompilers'));

                    foreach ($compilers as $compiler) {
                        if (\is_array($compiler)) {
                            $container->addCompilerPass($compiler[0], $compiler[1]);
                        } else {
                            $container->addCompilerPass($compiler);
                        }
                    }

                    $loader = new XmlFileLoader($container, new FileLocator($module->getAbsoluteConfigPath()));
                    $loader->load("config.xml", "module." . $module->getCode());

                    $envConfigFileName = sprintf("config_%s.xml", $this->environment);
                    $envConfigFile = sprintf('%s%s%s', $module->getAbsoluteConfigPath(), DS, $envConfigFileName);

                    if (is_file($envConfigFile) && is_readable($envConfigFile)) {
                        $loader->load($envConfigFileName, "module." . $module->getCode());
                    }
                } catch (\Exception $e) {
                    Tlog::getInstance()->addError(
                        sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()),
                        $e
                    );
                }
            }

            $parser = $container->getDefinition('thelia.parser');

            /** @var \Thelia\Core\Template\TemplateHelperInterface $templateHelper */
            $templateHelper = $container->get('thelia.template_helper');

            /** @var Module $module */
            foreach ($modules as $module) {
                try {
                    $this->loadModuleTranslationDirectories($module, $translationDirs, $templateHelper);

                    $this->addStandardModuleTemplatesToParserEnvironment($parser, $module);
                } catch (\Exception $e) {
                    Tlog::getInstance()->addError(
                        sprintf("Failed to load module %s: %s", $module->getCode(), $e->getMessage()),
                        $e
                    );
                }
            }

            // Load core translation
            $translationDirs['core'] = THELIA_LIB . 'Config' . DS . 'I18n';

            // Load core translation
            $translationDirs[Translator::GLOBAL_FALLBACK_DOMAIN] = THELIA_LOCAL_DIR . 'I18n';

            // Standard templates (front, back, pdf, mail)
            /** @var TemplateDefinition $templateDefinition */
            foreach ($templateHelper->getStandardTemplateDefinitions() as $templateDefinition) {
                // Load parent templates transaltions, the current template translations.
                $templateList = array_merge(
                    $templateDefinition->getParentList(),
                    [ $templateDefinition ]
                );

                /** @var TemplateDefinition $tplDef */
                foreach ($templateList as $tplDef) {
                    if (is_dir($dir = $tplDef->getAbsoluteI18nPath())) {
                        $translationDirs[$tplDef->getTranslationDomain()] = $dir;
                    }
                }
            }

            if ($translationDirs) {
                $this->loadTranslation($container, $translationDirs);
            }
        }
    }
441483
public function load(ContainerBuilder $container, array $config)
    {
        $container->setDefinition(self::API_CLIENT_ID, new Definition(ApiClient::class, [
            new Reference(SymfonyExtension::DRIVER_KERNEL_ID),
            $config['base_url']
        ]));

        $this->loadContextInitializer($container);
        $this->loadApiClientListener($container);

        $container->setParameter('symfony_api_extension.parameters', $config);
    }