Load queues from user configuration

@param ContainerBuilder $container SF2 Container Builder
@param array            $config    Configuration array

@return {$this}
10392
public function loadQueues(ContainerBuilder $container, array $config)
    {
        foreach ($config as $name => $attributes) {
            $container
                ->setDefinition(
                    self::getQueueServiceKey($name),
                    new Definition(
                        $container->getParameter('llssqs.model.queue.class'),
                        array(
                            new Reference(
                                LLSAWSExtension::getServiceServiceKey($attributes['service'])
                            ),
                            new Reference('llssqs.model.message.factory'),
                            $attributes['name']
                        )
                    )
                );
        }

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

        if (isset($config['fixtures'])) {
            $container->setParameter('behat.alice.fixtures.default', $config['fixtures']['default']);
            $container->setParameter('behat.alice.fixtures.key_paths', $config['fixtures']['key_paths']);
            $container->setParameter('behat.alice.fixtures.default_loading', $config['fixtures']['default_loading']);
        }

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

        $container->setParameter('behat.alice.faker.locale', $config['faker']['locale']);
        $container->setParameter('behat.alice.faker.providers', $config['faker']['providers']);

        $adapters = array();
        foreach ($config['adapters'] as $name => $adapter) {
            $adapters[$name] = $adapter['fixture_class'];

            if (isset($adapter['mapping'])) {
                $container->setParameter('behat.alice.elastica_mapping', $adapter['mapping']);
            }

            if (isset($adapter['index_service'])) {
                $container->setParameter('behat.alice.elastica_index', $adapter['index_service']);
            }
        }
        $container->setParameter('behat.alice.adapters', $adapters);
    }
653200
public function load(array $config, ContainerBuilder $container)
    {
        $processor = new Processor();
        $configuration = new Configuration();

        $config = $processor->processConfiguration($configuration, $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));

        $loader->load('moip.xml');

        $enviroment = Moip::ENDPOINT_SANDBOX;
        if ($config['production']) {
            $enviroment = Moip::ENDPOINT_PRODUCTION;
        }

        $authenticationClass = 'moip.authenticator.basic';
        if ($config['authentication_mode'] == 'OAuth') {
            $authenticationClass = 'moip.authenticator.oauth';
        }

        $container->setAlias('moip.authenticator', $authenticationClass);
        $container->setParameter('moip.credential.key', $config['credential']['key']);
        $container->setParameter('moip.credential.token', $config['credential']['token']);
        $container->setParameter('moip.environment', $enviroment);
    }
1353472
protected function buildContainer($config)
    {
        $container = new ContainerBuilder(new ParameterBag($this->getParameters()));

        $this->prepareContainer($container);
        $this->getContainerLoader($container)->load($config);

        return $container;
    }
1168479
protected function configureHydrator(array $config, ContainerBuilder $container)
    {
        if (!$container->hasDefinition($config['hydrator'])) {
            throw new \RuntimeException(sprintf('Unable to load hydrator service "%s"', $config['hydrator']));
        }

        $container->getDefinition('eko_feed.feed.reader')
            ->addMethodCall('setHydrator', [new Reference($config['hydrator'])]);
    }
1146774
public function load(array $configs, ContainerBuilder $container)
    {
        $config = $this->processConfiguration(new Configuration(), $configs);

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

        if (isset($config['quicklist'])) {
            $loader->load('quicklist.xml');
            foreach ($config['quicklist'] as $name => $quicklistConfig) {
                $container->getDefinition('zicht_admin.quicklist')
                    ->addMethodCall('addRepositoryConfig', array($name, $quicklistConfig));

                $formResources = $container->getParameter('twig.form.resources');
                $formResources[]= 'ZichtAdminBundle::form_theme.html.twig';
                $container->setParameter('twig.form.resources', $formResources);
            }
        }

        if (isset($config['transactional_listener']) && $config['transactional_listener']['auto']) {
            $loader->load('transactional_listener.xml');

            $container->getDefinition('zicht_admin.transactional_listener')
                ->addArgument($config['transactional_listener']['pattern']);
        }

        if (isset($config['rc'])) {
            $loader->load('rc.xml');
            $container->getDefinition('zicht_admin.controller.rc')->replaceArgument(0, $config['rc']);
        }

        $container->getDefinition('zicht_admin.security.authorization.voter.admin_voter')
            ->replaceArgument(0, $config['security']['mapped_attributes']);
    }
504908
private function loadParameters(ContainerBuilder $container, array $config)
    {
        // Store config in parameters array to be passed into the DrupalContext.
        $drupal_parameters = array();
        foreach ($config as $key => $value) {
            $drupal_parameters[$key] = $value;
        }
        $container->setParameter('drupal.parameters', $drupal_parameters);

        $container->setParameter('drupal.region_map', $config['region_map']);
    }
47759
public function load(array $config, ContainerBuilder $container): void
    {
        $config = $this->processConfiguration($this->getConfiguration([], $container), $config);
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.xml');

        if ($config['assets']['enabled']) {
            $loader->load('services/integrations/assets.xml');
        }

        if ($config['templating']['enabled']) {
            $loader->load('services/integrations/templating.xml');
        }

        if ($config['translations']['enabled']) {
            $loader->load('services/integrations/translations.xml');
        }

        $this->resolveConfigurationSources($container, $config);

        $container->setAlias('sylius.context.theme', $config['context']);
        $container->setAlias(ThemeContextInterface::class, 'sylius.context.theme');
    }
205262
protected function process(array $config, ContainerBuilder $container)
    {
        $container->setParameter('qcm_core.website_name', $config['website_name']);
        $container->setParameter('qcm.model.user.class', $config['user_class']);
        $container->setParameter('qcm.configuration', $config['configuration']);
        $container->setParameter('qcm_core.statistics.class', $config['service']['statistics']['class']);
        $container->setParameter('qcm_core.template.class', $config['service']['statistics']['template']);

        $container->setAlias('qcm.configuration', $config['service']['configuration']);
        $container->setAlias('qcm.user_session_configuration', $config['service']['user_session_configuration']);

        return $config;
    }
128377
private function loadDocumentTree($config, ContainerBuilder $container)
    {
        $configuration = [
            'routing_defaults' => $config['routing_defaults'],
            'repository_name' => $config['repository_name'],
            'sortable_by' => $config['sortable_by'],
            'move' => true,
            'reorder' => true,
        ];

        $container->setParameter('sonata_admin_doctrine_phpcr.tree_block.configuration', $configuration);

        foreach ($configuration as $key => $value) {
            $container->setParameter('sonata_admin_doctrine_phpcr.tree_block.'.$key, $value);
        }
    }
1157267
protected function loadConfiguration(array $config, ContainerBuilder $container)
    {
        // Load page nested routes
        $routeConfigurationChain = $container->findDefinition('lp_factory.route_configuration.chain');
        foreach ($config['routes'] as $alias => $routeConfiguration) {
            $routeConfigurationChain->addMethodCall('add', array($alias, $routeConfiguration));
        }

        $routeFactoryId = $config['service_ids']['factory'];
        $treeStrategyId = $config['service_ids']['strategy'];

        // Inject service route factory
        $routeProvider = $container->findDefinition('lp_factory.route_provider');
        $routeProvider->replaceArgument(0, new Reference($routeFactoryId));
        $routeProvider->replaceArgument(3, new Reference($treeStrategyId));

        // Add repository and strategy arguments
        $routeFactory = $container->findDefinition($routeFactoryId);
        $routeFactory->replaceArgument(0, new Reference($config['repository']));
        $routeFactory->replaceArgument(1, new Reference($treeStrategyId));
        $abstractStrategy = $container->findDefinition('lp_factory.route_strategy.abstract');
        $abstractStrategy->replaceArgument(0, new Reference($config['repository']));
    }
639283
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $this->config = $this->processConfiguration($configuration, $configs);

        foreach (ServicesFactory::getAvailableServices() as $service) {
            $serviceKey = StringUtil::camelcaseToUnderscore($service);
            $definition = new Definition('Aws\\'.$service.'\\'.$service.'Client', array($this->getConfig($serviceKey)));
            $definition->setPublic(true);
            $container->setDefinition('aws.'.$serviceKey, $definition);
        }
    }
210209
private function configurePlugins(ContainerBuilder $container, array $config)
    {
        if (!empty($config['authentication'])) {
            $this->configureAuthentication($container, $config['authentication']);
        }
        unset($config['authentication']);

        foreach ($config as $name => $pluginConfig) {
            $pluginId = 'httplug.plugin.'.$name;

            if ($this->isConfigEnabled($container, $pluginConfig)) {
                $def = $container->getDefinition($pluginId);
                $this->configurePluginByName($name, $def, $pluginConfig, $container, $pluginId);
            }
        }
    }
957343
public function configure(array $config, ConfigurationInterface $configuration, ContainerBuilder $container)
    {
        $processor = new Processor();
        $config    = $processor->processConfiguration($configuration, $config);

        $loader = new XmlFileLoader($container, new FileLocator($this->getConfigurationDirectory()));

		foreach(WallPosterBundle::getAvailableProviders() as $service)
		{
			if(isset($config[$service]))
			{
				$this->mapParameters($service, $config[$service], $container);
				$this->loadConfigurationFile($service,$loader);
			}
		}

        return array($config, $loader);
    }
908807
protected function loadFirewall(array $config, ContainerBuilder $container)
    {
    	// make sure the pool is specified and it exists
    	$pool = $config['firewall']['pool'];
    	if (null === $pool) {
    		return;
    	}
    	if (!isset($config['pools']) || !isset($config['pools'][$pool])) {
    		throw new \LogicException(sprintf('The pool "%s" does not exist! Cannot enable the firewall!', $pool));
    	}
    	// calculate options
    	$options = array();
    	$options['prefix'] = $config['firewall']['prefix'];
    	$options['concurrency']    = $config['firewall']['concurrency'];
    	$options['spin_lock_wait'] = $config['firewall']['spin_lock_wait'];
    	$options['lock_max_wait']  = $config['firewall']['lock_max_wait'];
    	$options['reverse_proxies']  = $config['firewall']['reverse_proxies'];
    	$options['x_forwarded_for']  = $config['firewall']['x_forwarded_for'];
    	// load the firewall handler
    	$definition = new Definition($container->getParameter('memcache.firewall_handler.class'));
    	$container->setDefinition('memcache.firewall_handler', $definition);
    	$definition
    	    ->addArgument(new Reference(sprintf('memcache.%s', $pool)))
    	    ->addArgument($options);
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.request','method'=>'onKernelRequest'));
    	$definition->addTag('kernel.event_listener', array('event'=>'kernel.terminate','method'=>'onKernelTerminate'));
    	$this->addClassesToCompile(array($definition->getClass()));
    }
1010632
public function load(array $config, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $this->configureStorage($config, $container);
        $this->configureMetadataDriver($config, $container);
        $this->configureEntityManager($config, $container);
    }
1366421
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = $this->createConfigurationParser();
        $this->globalConfiguration = $this->processConfiguration($configuration, $configs);

        $container->setParameter('sidus_eav_publishing.queue.configuration', $this->globalConfiguration['queue']);

        foreach ($this->globalConfiguration['publishers'] as $code => $publisherConfiguration) {
            $this->createPublisherService($code, $publisherConfiguration, $container);
        }

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