Loads the url shortener configuration.

@param array            $configs   An array of configuration settings
@param ContainerBuilder $container A ContainerBuilder instance
329697
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();
        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

        $config = $this->addDefaults($config);

        if ('orm' !== $config['manager_type']) {
            throw new \RuntimeException('Only ORM manager is implemented');
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('timeline.xml');
        $loader->load(sprintf('timeline_%s.xml', $config['manager_type']));

        // NEXT_MAJOR: Go back to simple xml configuration when bumping requirements to SF 2.6+
        if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) {
            $tokenStorageReference = new Reference('security.token_storage');
        } else {
            $tokenStorageReference = new Reference('security.context');
        }

        $container
            ->getDefinition('sonata.timeline.admin.extension')
            ->replaceArgument(1, $tokenStorageReference)
        ;

        $container
            ->getDefinition('sonata.timeline.block.timeline')
            ->replaceArgument(4, $tokenStorageReference)
        ;

        $this->configureClass($config, $container);
        $this->registerDoctrineMapping($config);
    }
1347055
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        foreach ($config['connections'] as $name => $cacheConfig) {
            $cacheConfig['name'] = $name;
            switch ($cacheConfig['driver']) {
                case 'redis':
                    $this->configureRedisCache($cacheConfig, $container);

                    break;

                case 'memcached':
                case 'memcache':
                    $this->configureMemcachedCache($cacheConfig, $container);

                    break;

                case 'array':
                    $this->configureArrayCache($cacheConfig, $container);

                    break;
            }
        }
    }
582338
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('delivery.xml');
        $loader->load('form.xml');

        $container->setAlias('sonata.delivery.selector', $config['selector']);

        $this->configureDelivery($container, $config);
    }
1322217
public function load(array $configs, ContainerBuilder $container)
    {
        $processor = new Processor();

        // first assemble the adapter factories
        $factoryConfig = new FactoryConfiguration();
        $config        = $processor->processConfiguration($factoryConfig, $configs);

        // create a service for each adapter
        $factories     = $this->createAdapterFactories($config, $container);

        // then normalize the configs
        $mainConfig = new Configuration($factories);
        $config     = $processor->processConfiguration($mainConfig, $configs);

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

        $map = array();
        foreach ($config['file_system_list'] as $filesystem => $adapter) {
            $adapterName = array_keys($adapter);
            $adapterName = $adapterName[0];
            $adapterParameter = $adapter[$adapterName];

            if (array_key_exists($adapterName, $factories)) {
                $filesystemId      = sprintf('kitpages_file_system.file_system.%s', $filesystem);
                // create a filesystem service with his adapter
                $factories[$adapterName]->create($container, $filesystemId, $adapterParameter);
;
                $map[$filesystem] = new Reference($filesystemId);
            }


        }

        //allows calls to filesystem services with $this->get('kitpages_file_system.filesystem_map')->getAdapter(filesystemName);
        $container->getDefinition('kitpages_file_system.file_system_map')
            ->replaceArgument(0, $map);
    }
35734
public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(
            $this->getConfiguration($configs, $container),
            $configs
        );

        $container->setParameter('liip_imagine.resolvers', $config['resolvers']);
        $container->setParameter('liip_imagine.loaders', $config['loaders']);

        $this->loadResolvers($config['resolvers'], $container);
        $this->loadLoaders($config['loaders'], $container);

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

        if ($config['enqueue']) {
            $loader->load('enqueue.xml');
        }

        $container->setParameter('liip_imagine.driver_service', 'liip_imagine.'.$config['driver']);

        $container->setAlias('liip_imagine', new Alias('liip_imagine.'.$config['driver']));
        $container->setAlias(CacheManager::class, new Alias('liip_imagine.cache.manager', false));
        $container->setAlias(DataManager::class, new Alias('liip_imagine.data.manager', false));
        $container->setAlias(FilterManager::class, new Alias('liip_imagine.filter.manager', false));

        $container->setParameter('liip_imagine.cache.resolver.default', $config['cache']);

        $container->setParameter('liip_imagine.default_image', $config['default_image']);

        $container->setParameter('liip_imagine.filter_sets', $config['filter_sets']);
        $container->setParameter('liip_imagine.binary.loader.default', $config['data_loader']);

        $container->setParameter('liip_imagine.controller.filter_action', $config['controller']['filter_action']);
        $container->setParameter('liip_imagine.controller.filter_runtime_action', $config['controller']['filter_runtime_action']);

        $container->setParameter('twig.form.resources', array_merge(
            $container->hasParameter('twig.form.resources') ? $container->getParameter('twig.form.resources') : [],
            ['@LiipImagine/Form/form_div_layout.html.twig']
        ));
    }
471500
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $container->setParameter("draw_swagger.schema", $config['schema']);

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

        // The order that extractor get registered is important so th fos_rest.yml must be loaded first
        if(class_exists(\FOS\RestBundle\Routing\Loader\Reader\RestControllerReader::class)) {
            $loader->load('fos_rest.yml');
        }

        $loader->load('swagger.yml');

        $definition = $container->getDefinition("draw.swagger.extrator.type_schema_extractor");

        foreach ($config['definitionAliases'] as $alias) {
            $definition->addMethodCall(
                'registerDefinitionAlias',
                [$alias['class'], $alias['alias']]
            );
        }

        if(class_exists(\Doctrine\ORM\EntityManager::class)) {
            $container->setDefinition(
                DoctrineInheritanceExtractor::class,
                $definition = new Definition(DoctrineInheritanceExtractor::class, [new Reference('doctrine')])
            );

            $definition->addTag('swagger.extractor');
        }
    }
978430
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->register('security.firewall_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['firewall']);
        $container->register('security.auth_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['login_path'])
            ->addArgument(null)
            ->addArgument('POST');
        $container->register('security.logout_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['logout_path']);

        $authenticatorService = $this->configureAuthenticator($config['authenticator'], $container);

        $container->register('security.security_subscriber', 'Nice\Security\FirewallSubscriber')
            ->addArgument(new Reference('event_dispatcher'))
            ->addArgument(new Reference('security.firewall_matcher'))
            ->addArgument(new Reference('security.auth_matcher'))
            ->addArgument(new Reference('security.logout_matcher'))
            ->addArgument(new Reference($authenticatorService))
            ->addArgument($config['login_path'])
            ->addArgument($config['success_path'])
            ->addArgument($config['token_session_key'])
            ->addTag('kernel.event_subscriber');

        $container->register('security.auth_failure_subscriber', 'Nice\Security\AuthenticationFailureSubscriber')
            ->addTag('kernel.event_subscriber');
    }
954304
public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);

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

        $adapters = array();

        foreach ($config['adapters'] as $name => $adapter) {
            $adapters[$name] = $this->createAdapter($name, $adapter, $container, $this->factories);
        }

        $map = array();
        foreach ($config['filesystems'] as $name => $filesystem) {
            $map[$name] = $this->createFilesystem($name, $filesystem, $container, $adapters);
        }

        $container->getDefinition('knp_gaufrette.filesystem_map')
            ->setPublic(true)
            ->replaceArgument(0, $map);

        if (isset($config['stream_wrapper'])) {
            $container->setParameter('knp_gaufrette.stream_wrapper.protocol', $config['stream_wrapper']['protocol']);
            $container->setParameter('knp_gaufrette.stream_wrapper.filesystems', $config['stream_wrapper']['filesystems']);
        }
    }
352307
public function load(array $configs, ContainerBuilder $container)
    {
        parent::load($configs, $container);

        // define alias for the strategy to extract the authentication key from the Airlock request.
        $container->setAlias(
            'graviton.security.authentication.strategy',
            $container->getParameter('graviton.security.authentication.strategy')
        );

        $container->setAlias(
            'graviton.security.authentication.dynamic.model',
            $container->getParameter('graviton.security.authentication.provider.model')
        );
    }
13920
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->register('doctrine.orm.metadata_driver', 'Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain');

        foreach ($config['mapping'] as $name => $mappingConfig) {
            $mappingConfig['name'] = $name;
            $this->configureMappingDriver($mappingConfig, $container);
        }

        $container->register('doctrine.orm.configuration', 'Doctrine\ORM\Configuration')
            ->addMethodCall('setMetadataDriverImpl', array(new Reference('doctrine.orm.metadata_driver')))
            ->addMethodCall('setProxyNamespace', array('Proxy'));

        if ($container->hasParameter('app.cache') && $container->getParameter('app.cache') === true) {
            $container->getDefinition('doctrine.orm.configuration')
                ->addMethodCall('setProxyDir', array('%app.cache_dir%/doctrine'));
        } else {
            $container->getDefinition('doctrine.orm.configuration')
                ->addMethodCall('setProxyDir', array(sys_get_temp_dir().'/doctrine'))
                ->addMethodCall('setAutoGenerateProxyClasses', array(AbstractProxyFactory::AUTOGENERATE_EVAL));

        }

        $container->register('doctrine.orm.entity_manager', 'Doctrine\ORM\EntityManager')
            ->setFactoryClass('Doctrine\ORM\EntityManager')
            ->setFactoryMethod('create')
            ->addArgument($config['database'])
            ->addArgument(new Reference('doctrine.orm.configuration'));

        $container->setAlias('doctrine.dbal.configuration', new Alias('doctrine.orm.configuration'));

        $container->register('doctrine.dbal.database_connection', 'Doctrine\DBAL\Connection')
            ->setFactoryService('doctrine.orm.entity_manager')
            ->setFactoryMethod('getConnection');
    }
1149111
public function load(array $configs, ContainerBuilder $container)
    {
        parent::load($configs, $container);

        $configuration = $this->createConfigurationParser();
        $this->globalConfiguration = $this->processConfiguration($configuration, $configs);

        $dataGridRegistry = $container->getDefinition(DataGridRegistry::class);
        foreach ((array) $this->globalConfiguration['configurations'] as $code => $dataGridConfiguration) {
            $dataGridConfiguration = $this->finalizeConfiguration($code, $dataGridConfiguration);
            $dataGridRegistry->addMethodCall('addRawDataGridConfiguration', [$code, $dataGridConfiguration]);
        }
    }
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');
        }
    }
769826
public function load(array $configs, ContainerBuilder $containerBuilder)
    {
        // This parameter is unused, but not optional. This line will avoid a static analysis warning this.
        $configs;

        $loader = new YamlFileLoader($containerBuilder, new FileLocator(__DIR__ . '/../../config'));
        $loader->load('services.yml');
    }
1337007
public function load(array $configs, ContainerBuilder $container): void
    {
        $configuration = new Configuration($this->getAlias());
        $this->processConfiguration($configuration, $configs);

        foreach (Iter::makeOneDimension($configs[0], self::ALIAS) as $key => $value) {
            $container->setParameter($key, $value);
        }
    }
120955
public function load(array $configs, ContainerBuilder $container)
    {
        $processor     = new Processor();
        $configuration = new Configuration($container->getParameter('kernel.debug'));
        $config = $processor->processConfiguration($configuration, $configs);

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

        $container
            ->getDefinition('bazinga.jstranslation.controller')
            ->replaceArgument(5, $config['locale_fallback'])
            ->replaceArgument(6, $config['default_domain'])
            ->replaceArgument(7, $config['http_cache_time']);

        // Add fallback locale to active locales if missing
        if ($config['active_locales'] && !in_array($config['locale_fallback'], $config['active_locales'])) {
            array_push($config['active_locales'], $config['locale_fallback']);
        }

        $container
            ->getDefinition('bazinga.jstranslation.translation_dumper')
            ->replaceArgument(3, $config['locale_fallback'])
            ->replaceArgument(4, $config['default_domain'])
            ->replaceArgument(5, $config['active_locales'])
            ->replaceArgument(6, $config['active_domains']);
    }
659221
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

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

        $loader->load('parameters.yml');
        $loader->load('services.yml');

        $registry = $container->getDefinition('uecode_qpush.registry');
        $cache    = $config['cache_service'] ?: 'uecode_qpush.file_cache';

        foreach ($config['queues'] as $queue => $values) {

            // Adds logging property to queue options
            $values['options']['logging_enabled'] = $config['logging_enabled'];

            $provider   = $values['provider'];
            $class      = null;
            $client     = null;

            switch ($config['providers'][$provider]['driver']) {
                case 'aws':
                    $class  = $container->getParameter('uecode_qpush.provider.aws');
                    $client = $this->createAwsClient(
                        $config['providers'][$provider],
                        $container,
                        $provider
                    );
                    break;
                case 'ironmq':
                    $class  = $container->getParameter('uecode_qpush.provider.ironmq');
                    $client = $this->createIronMQClient(
                        $config['providers'][$provider],
                        $container,
                        $provider
                    );
                    break;
                case 'sync':
                    $class  = $container->getParameter('uecode_qpush.provider.sync');
                    $client = $this->createSyncClient();
                    break;
                case 'custom':
                    $class  = $container->getParameter('uecode_qpush.provider.custom');
                    $client = $this->createCustomClient($config['providers'][$provider]['service']);
                    break;
                case 'file':
                    $class = $container->getParameter('uecode_qpush.provider.file');
                    $values['options']['path'] = $config['providers'][$provider]['path'];
                    break;
                case 'doctrine':
                    $class = $container->getParameter('uecode_qpush.provider.doctrine');
                    $client = $this->createDoctrineClient($config['providers'][$provider]);
                    break;
            }

            $definition = new Definition(
                $class, [$queue, $values['options'], $client, new Reference($cache), new Reference('logger')]
            );

            $definition->setPublic(true);

            $definition->addTag('monolog.logger', ['channel' => 'qpush'])
                ->addTag(
                    'uecode_qpush.event_listener',
                    [
                        'event' => "{$queue}.on_notification",
                        'method' => "onNotification",
                        'priority' => 255
                    ]
                )
                ->addTag(
                    'uecode_qpush.event_listener',
                    [
                        'event' => "{$queue}.message_received",
                        'method' => "onMessageReceived",
                        'priority' => -255
                    ]
                );

            $isProviderAWS = $config['providers'][$provider]['driver'] === 'aws';
            $isQueueNameSet = isset($values['options']['queue_name']) && !empty($values['options']['queue_name']);

            if ($isQueueNameSet && $isProviderAWS) {
                $definition->addTag(
                    'uecode_qpush.event_listener',
                    [
                        'event' => "{$values['options']['queue_name']}.on_notification",
                        'method' => "onNotification",
                        'priority' => 255
                    ]
                );

                // Check queue name ends with ".fifo"
                $isQueueNameFIFOReady = preg_match("/$(?<=(\.fifo))/", $values['options']['queue_name']) === 1;
                if ($values['options']['fifo'] === true && !$isQueueNameFIFOReady) {
                    throw new InvalidArgumentException('Queue name must end with ".fifo" on AWS FIFO queues');
                }
            }

            $name = sprintf('uecode_qpush.%s', $queue);
            $container->setDefinition($name, $definition);

            $registry->addMethodCall('addProvider', [$queue, new Reference($name)]);
        }
    }
815738
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $defaults = Yaml::parseFile(__DIR__.'/../Resources/config/cms/config.yml');

        foreach ($configs as $config) {
            foreach ($config as $key => $value) {
                $defaults['networking_init_cms'][ $key ] = $value;
            }
        }

        $config = $this->processConfiguration($configuration, $defaults);

        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('blocks.xml');
        $loader->load('event_listeners.xml');
        $loader->load('forms.xml');
        $loader->load('menus.xml');
        $loader->load('twig.xml');
        $loader->load('services.xml');
        $loader->load('validators.xml');

        //mongodb is not yet fully supported but will come (eventually)
        if ('custom' !== $config['db_driver']) {
            $loader->load(sprintf('doctrine_%s.xml', $config['db_driver']));
            $loader->load(sprintf('ext_admin_%s.xml', $config['db_driver']));
            $loader->load(sprintf('admin_%s.xml', $config['db_driver']));
        }

        $config['languages'] = $this->addShortLabels($config['languages']);

        $container->setParameter('networking_init_cms.page.languages', $config['languages']);
        $container->setParameter('networking_init_cms.page.templates', $config['templates']);
        $container->setParameter('networking_init_cms.page.content_types', $config['content_types']);
        $container->setParameter(
            'networking_init_cms.translation_fallback_route',
            $config['translation_fallback_route']
        );
        $container->setParameter(
            'networking_init_cms.multiple_media_tags',
            $config['multiple_media_tags']
        );
        $container->setParameter(
            'networking_init_cms.show_tag_tree',
            $config['show_tag_tree']
        );

        if (!$config['admin_toolbar']['toolbar']) {
            $mode = AdminToolbarSubscriber::DISABLED;
        } else {
            $mode = AdminToolbarSubscriber::ENABLED;
        }
        $container->setParameter('networking_init_cms.admin_toolbar.mode', $mode);
        $container->setParameter('networking_init_cms.admin_toolbar.position', $config['admin_toolbar']['position']);

        $container->setParameter('networking_init_cms.404_template', $config['404_template']);
        $container->setParameter('networking_init_cms.no_translation_template', $config['no_translation_template']);
        $container->setParameter('networking_init_cms.admin_menu_groups', $config['admin_menu_groups']);
        $container->setParameter('networking_init_cms.db_driver', $config['db_driver']);

        if ($config['db_driver'] == 'orm') {
            $this->registerDoctrineORMMapping($config);
        }

        $container->setParameter('networking_init_cms.cache.activate', $config['cache']['activate']);
        $container->setParameter('networking_init_cms.cache.cache_time', $config['cache']['cache_time']);
        $cacheClass = $config['cache']['cache_service_class'];
        $reflectionClass = new \ReflectionClass($cacheClass);

        $container->setParameter('networking_init_cms.xml_sitemap.sitemap_url', $config['xml_sitemap']['sitemap_url']);
        $container->setParameter('networking_init_cms.xml_sitemap.additional_links', $config['xml_sitemap']['additional_links']);

        if (in_array('Networking\InitCmsBundle\Lib\PhpCacheInterface', $reflectionClass->getInterfaceNames())) {
            $container->setParameter('networking_init_cms.lib.php_cache.class', $config['cache']['cache_service_class']);
        } else {
            throw new InvalidParameterException('Cache class should implement the PhpCacheInterface interface');
        }
        $this->configureLanguageCookie($config, $container);

        $this->configureClass($config, $container);
    }