@param mixed[]          $config
@param ContainerBuilder $container

@return string[]
517789
private function resolveMappingPaths(array $config, ContainerBuilder $container)
    {
        $paths = [];

        if ($config['auto']['enabled']) {
            $bundles = $container->getParameter('kernel.bundles');

            foreach ($bundles as $bundle) {
                $bundlePath = dirname((new \ReflectionClass($bundle))->getFileName());

                foreach ($config['auto']['paths'] as $relativePath) {
                    $path = $bundlePath.'/'.$relativePath;

                    if (file_exists($path)) {
                        $paths[] = $path;
                    }
                }
            }
        }

        return array_merge($paths, $config['paths']);
    }
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);
        }
    }
882721
public function load(array $config, ContainerBuilder $container)
    {
        $container->setParameter('maba_oauth_commerce.internal_client.default_base_url', null);

        $container
            ->register(
                'maba_oauth_commerce.normalizer.client_credentials',
                'Maba\OAuthCommerceInternalClient\Normalizer\ClientCredentialsNormalizer'
            )
            ->setArguments(array(new Reference('maba_oauth_commerce.algorithm_manager')))
            ->addTag('maba_oauth_commerce.normalizer')
            ->setPublic(false)
        ;
        $container
            ->setDefinition(
                'maba_oauth_commerce.factory.internal',
                new DefinitionDecorator('maba_oauth_commerce.factory.base')
            )
            ->addMethodCall('setDefaultBaseUrl', array('%maba_oauth_commerce.internal_client.default_base_url%'))
            ->setClass('Maba\OAuthCommerceInternalClient\InternalClientFactory')
        ;
    }
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);
            }
        }
    }
144864
protected function configureTwigBundle(ContainerBuilder $container, array $config)
    {
        if ($container->hasExtension('twig')) {
            $resources = array('LifoTypeaheadBundle:Form:typeahead.html.twig');
            if (Kernel::VERSION_ID >= '20600') {
                $container->prependExtensionConfig('twig', array('form_themes' => $resources));
            } else {
                $container->prependExtensionConfig('twig', array('form' => array('resources' => $resources)));
            }
        }
    }
38991
private function getBuses(ContainerBuilder $container)
    {
        $buses = [];
        $busDefinitions = $container->findTaggedServiceIds('sokil.command_bus');
        foreach ($busDefinitions as $busServiceId => $busTags) {
            foreach ($busTags as $busTagParams) {
                $buses[$busServiceId] = $container->findDefinition($busServiceId);
            }
        }

        return $buses;
    }
61870
public function build(array $config, ContainerInterface $container = null)
    {
        $dispatcher = new Dispatcher($container);
        foreach ((array) $config as $name => $listeners) {
            foreach ($listeners as $listener) {
                if (is_callable($listener)) {
                    $dispatcher->register($name, $listener);
                    continue;
                }

                $listener = $this->applyDefaults($listener);

                $dispatcher->register(
                    $name,
                    $this->buildDefinition($listener)
                );
            }
        }

        return $dispatcher;
    }
1187063
protected function postLoad(array $config, ContainerBuilder $container)
    {
        $this
            ->loadBlocks($config['blocks'], $container)
            ->loadStatics($config['statics'], $container)
            ->loadBuilders($config['builders'], $container)
            ->loadDumpers($config['builders'], $container)
            ->loadProfiles($config['profiles'], $container);
    }
1291658
public function configureMultisite(ContainerBuilder $container, array $config)
    {
        $multisite = $config['multisite'];

        if ('host' === $multisite) {
            $container->setAlias('sonata.page.site.selector', 'sonata.page.site.selector.host');

            $container->removeDefinition('sonata.page.site.selector.host_by_locale');
            $container->removeDefinition('sonata.page.site.selector.host_with_path');
            $container->removeDefinition('sonata.page.site.selector.host_with_path_by_locale');
        } elseif ('host_by_locale' === $multisite) {
            $container->setAlias('sonata.page.site.selector', 'sonata.page.site.selector.host_by_locale');

            $container->removeDefinition('sonata.page.site.selector.host');
            $container->removeDefinition('sonata.page.site.selector.host_with_path');
            $container->removeDefinition('sonata.page.site.selector.host_with_path_by_locale');
        } else {
            /*
             * The multipath option required a specific router and RequestContext
             */
            $container->setAlias('router.request_context', 'sonata.page.router.request_context');

            if ('host_with_path' === $multisite) {
                $container->setAlias('sonata.page.site.selector', 'sonata.page.site.selector.host_with_path');

                $container->removeDefinition('sonata.page.site.selector.host_with_path_by_locale');
                $container->removeDefinition('sonata.page.site.selector.host');
                $container->removeDefinition('sonata.page.site.selector.host_by_locale');
            } elseif ('host_with_path_by_locale' === $multisite) {
                $container->setAlias('sonata.page.site.selector', 'sonata.page.site.selector.host_with_path_by_locale');

                $container->removeDefinition('sonata.page.site.selector.host_with_path');
                $container->removeDefinition('sonata.page.site.selector.host');
                $container->removeDefinition('sonata.page.site.selector.host_by_locale');
            }
        }

        if ($container->hasAlias('sonata.page.site.selector')) {
            $container->getAlias('sonata.page.site.selector')->setPublic(true);
        }
    }
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'));
    }
222101
public function inject(Container $container) : array
    {
        $parameters = $this->arguments;
        foreach ($parameters as &$parameter) {
            $parameter = $this->getParameter($container, $parameter);
        }

        return $parameters;
    }
887841
public function load(ContainerBuilder $container, array $config)
    {
        $definition = new Definition('emuse\\BehatHTMLFormatter\\Formatter\\BehatHTMLFormatter');
        $definition->addArgument($config['name']);
        $definition->addArgument($config['renderer']);
        $definition->addArgument($config['file_name']);
        $definition->addArgument($config['print_args']);
        $definition->addArgument($config['print_outp']);
        $definition->addArgument($config['loop_break']);

        $definition->addArgument('%paths.base%');
        $container->setDefinition('html.formatter', $definition)
      ->addTag('output.formatter');
    }
870840
public function configurePageDefaults(ContainerBuilder $container, array $config)
    {
        $defaults = [
            'templateCode' => $config['default_template'],
            'enabled' => true,
            'routeName' => null,
            'name' => null,
            'slug' => null,
            'url' => null,
            'requestMethod' => null,
            'decorate' => true,
        ];

        $container->getDefinition('sonata.page.manager.page')
            ->replaceArgument(2, $defaults);

        foreach ($config['page_defaults'] as $name => $pageDefaults) {
            $config['page_defaults'][$name] = array_merge($defaults, $pageDefaults);
        }

        $container->getDefinition('sonata.page.manager.page')
            ->replaceArgument(3, $config['page_defaults']);
    }
1301456
public function configureSettings($config, ContainerBuilder $container)
    {
        $container->setParameter('rz_search.slugify_service',                                   $config['slugify_service']);
        $container->setParameter('rz_search.settings.search.pagination.per_page',               $config['search']['pagination']['per_page']);
        $container->setParameter('rz_search.settings.search.variables.search_query',            $config['search']['variables']['search_query']);
        $container->setParameter('rz_search.settings.search.variables.templates',               $config['search']['templates']);
        $container->setParameter('rz_search.settings.search.variables.default_identifier',      $config['search']['variables']['default_identifier']);

        $container->setParameter('rz_search.settings.search.controller.search',                 $config['search']['controller']['search']);
        $container->setParameter('rz_search.settings.search.controller.ajax',                   $config['search']['controller']['ajax']);
    }
937320
protected function loadConfigs(array $config, ContainerBuilder $container)
    {
        foreach ($config['configs'] as $name => $arguments) {
            if (!$arguments['enabled']) {
                continue;
            }

            $id = 'integrated_channel.config.memory.' . $name;

            if ($container->hasDefinition($id)) {
                continue;
            }

            // first create the options and for that we need a unique service id

            do {
                $id_options = $id . '.options.' . uniqid();
            } while ($container->hasDefinition($id_options));

            $definition = new Definition('%integrated_channel.config.options.class%');
            $definition->setPublic(false);
            $definition->setArguments([$arguments['options']]);

            $container->setDefinition($id_options, $definition);

            // create the config it self

            $definition = new Definition('%integrated_channel.config.class%');
            $definition->setArguments([
                $name,
                $arguments['adaptor'],
                new Reference($id_options)
            ]);

            if ($arguments['channel']) {
                foreach ($arguments['channel'] as $channel) {
                    $definition->addTag('integrated_channel.config', ['channel' => $channel]);
                }
            } else {
                $definition->addTag('integrated_channel.config');
            }

            $container->setDefinition($id, $definition);
        }
    }
373381
private function createResolvers(array $config, ContainerInterface $container)
    {
        $resolvers = [];

        foreach ($config as $resolver) {
            if ($resolver instanceof Resolver\ResolverInterface) {
                $resolvers[] = $resolver;
                continue;
            }

            if (! is_string($resolver)) {
                continue;
            }

            if ($container->has($resolver)) {
                $resolvers[] = $container->get($resolver);
                continue;
            }

            if (class_exists($resolver)) {
                $resolvers[] = new $resolver();
                continue;
            }
        }

        return $resolvers;
    }
700238
public function load(array $config, ContainerBuilder $container)
    {
        $rClass = new \ReflectionClass($this);

        $yamlLoader = new YamlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $xmlLoader = new XmlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $phpLoader = new PhpFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $this->registerCustom($container, $config);
        $this->registerConfigFiles($yamlLoader);
        $this->registerYamlConfigFiles($yamlLoader);
        $this->registerXmlConfigFiles($xmlLoader);
        $this->registerPhpConfigFiles($phpLoader);
        $this->registerCompilerPasses($container);

        /** @var CliApplication $application */
        $application = $container->get('application');

        $this->registerCommands($application);

        /** @var TemplatingServiceInterface $templatingService */
        $templatingService = $container->get('common.services.templating');
        $this->registerTemplates($templatingService);
    }