Configure error presentation factories

@param array            $factoryConfig
@param ContainerBuilder $container
771538
private function configureErrorPresentationFactory(array $factoryConfig, ContainerBuilder $container): void
    {
        if ($this->isConfigEnabled($container, $factoryConfig['validation'])) {
            $container->getDefinition('fivelab.resource.error_presentation_factory.validation_failed')
                ->setAbstract(false)
                ->replaceArgument(0, $factoryConfig['validation']['message'])
                ->replaceArgument(1, $factoryConfig['validation']['reason']);
        }
    }
538951
protected function loadExceptionManager(ContainerBuilder $container, array $config)
    {
        $definition = new Definition(
            'M6Web\Bundle\ApiExceptionBundle\Manager\ExceptionManager',
            [
                $config['default'],
                $config['exceptions'],
            ]
        );
        $definition->setPublic(true);

        $container->setDefinition($this->getAlias().'.manager.exception', $definition);
    }
501037
protected function configureAsseticBundle(ContainerBuilder $container, array $config)
    {
        foreach (array_keys($container->getExtensions()) as $name) {
            switch ($name) {
                case 'assetic':
                    $asseticConfig = new AsseticConfiguration;
                    $container->prependExtensionConfig(
                        $name,
                        array('assets' => $asseticConfig->build($config))
                    );
                    break;
            }
        }
    }
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);
        }
    }
739713
public function process(ContainerBuilder $container)
    {
        $this->setFactoryAndServerClasses($container);
        parent::process($container);
        $this->setCasServerConfig($container);
    }
569975
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('model.xml');
        $loader->load('form.xml');
        $loader->load('helper.xml');
        $loader->load('reader.xml');
        $loader->load('converter.xml');
        $loader->load('loader.xml');
        $loader->load('manager.xml');
        $loader->load('twig_extension.xml');
        $loader->load('validator.xml');
        $loader->load('cache.xml');

        $this->loadRepository($loader, $container, $config);
        $this->loadManager($loader, $container, $config);
        $this->loadRepoClass($loader, $container, $config);
        $this->loadCachePath($container, $config);
        $this->loadVersionEyeKey($container, $config);
    }
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']);
    }
1033359
private function configureMapManager($config, ContainerBuilder $container)
    {
        $mapManager = $container->getDefinition('sulu_location.map_manager');

        foreach ($config['enabled_providers'] as $enabledProviderName) {
            $providerConfig = $config['providers'][$enabledProviderName];
            $mapManager->addMethodCall('registerProvider', [
                $enabledProviderName,
                $providerConfig,
            ]);
        }

        foreach ($config['geolocators'] as $geoLocatorName => $geoLocatorOptions) {
            $mapManager->addMethodCall('registerGeolocator', [
                $geoLocatorName,
                $geoLocatorOptions,
            ]);
        }

        $mapManager->addMethodCall('setDefaultProviderName', [$config['default_provider']]);
    }
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);
    }
145641
private static function createConfiguration(array $config, ContainerInterface $container = null)
    {
        $cache = $config['cache'];

        if ($container && is_string($config['cache']) && $container->has($config['cache'])) {
            $cache = $container->get($config['cache']);
        }

        return Setup::createConfiguration($config['debug'], $config['proxy_dir'], $cache);
    }
1348517
protected function addPrismJSInAssetic(ContainerBuilder $container, array $config)
    {
        if ($config['js'] !== false && $config['css'] !== false) {
            $container->prependExtensionConfig('assetic', array(
                'assets' => array(
                    'prismjs_js' => $config['js'],
                    'prismjs_css' => $config['css'],
                ),
            ));
        } elseif ($config['js'] === false && $config['css'] !== false) {
            throw new InvalidConfigurationException('You have enabled PrismJS supports but js parameter is missing.');
        } elseif ($config['js'] !== false && $config['css'] === false) {
            throw new InvalidConfigurationException('You have enabled PrismJS supports but css parameter is missing.');
        }
    }
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']);
    }
952735
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = $this->getConfigurationInstance();
        if ($configuration) {
            $container->addObjectResource($configuration);
        }

        return $configuration;
    }
40342
private function configureWebpackAssets(ContainerBuilder $container, array $config): void
    {
        $assetsFile = $config['file'];
        $cacheId = $config['cache']['service_id'];
        $cacheKey = $config['cache']['key'];
        $cacheEnabled = $config['cache']['enabled'];
        $cacheEnabled = null !== $cacheEnabled
            ? $cacheEnabled
            : !$container->getParameter('kernel.debug');

        $container->setParameter('fxp_require_asset.webpack.adapter.assets.file', $assetsFile);
        $container->setParameter('fxp_require_asset.webpack.adapter.assets.cache_key', $cacheKey);

        if ($cacheEnabled) {
            $container->setAlias('fxp_require_asset.webpack.adapter.assets.cache', $cacheId);
        }
    }
912055
public function configureAsseticBundle(ContainerBuilder $container, array $config)
    {
        foreach (array_keys($container->getExtensions()) as $name) {
            switch ($name) {
                case 'assetic':
                    // Add jQuery in assets
                    $this->addJqueryInAssetic($container, $config['assets']['jquery']);

                    // Add Twitter Bootstrap assets
                    $this->addTwbsInAssetic($container, $config['assets']['twbs']);

                    // Add jQuery UI in assets
                    if (isset($config['assets']['jqueryui'])) {
                        $this->addJqueryUIInAssetic($container, $config['assets']['jqueryui']);
                    }

                    // Add select2 files
                    if (isset($config['assets']['select2'])) {
                        $this->addSelect2InAssetic($container, $config['assets']['select2']);
                    }

                    // Add Basinga js translation in assets
                    if (isset($config['assets']['bazinga_js_translation'])) {
                        $this->addBazingaJsTranslationInAssetic($container, $config['assets']['bazinga_js_translation']);
                    }

                    // Add Speaking URL in assets
                    if (isset($config['assets']['speakingurl'])) {
                        $this->addSpeakingURLInAssetic($container, $config['assets']['speakingurl']);
                    }

                    // Add TinyMCE in assets
                    if (isset($config['assets']['tinymce'])) {
                        $this->addTinyMCEInAssetic($container, $config['assets']['tinymce']);
                    }

                    // Add jQueryTagsInput in assets
                    if (isset($config['assets']['jquery_tags_input'])) {
                        $this->addJqueryTagsInputInAssetic($container, $config['assets']['jquery_tags_input']);
                    }

                    // Add PrismJS in assets
                    if (isset($config['assets']['prism_js'])) {
                        $this->addPrismJSInAssetic($container, $config['assets']['prism_js']);
                    }
                    break;
            }
        }
    }
174389
protected function validateConfig(array $config)
    {
        $validator = Validator::make($config, $this->getConfigValidationRules());

        if ($validator->fails()) {

            throw new ServiceConfigurationException(
                'Invalid configuration: ' . print_r($validator->messages()->toArray(), true),
                $validator->messages()->toArray()
            );
        }
    }
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');
    }