@param string           $code
@param array            $adminConfiguration
@param ContainerBuilder $container

@throws BadMethodCallException
181227
protected function createAdminServiceDefinition($code, array $adminConfiguration, ContainerBuilder $container): void
    {
        $adminConfiguration = array_merge(['action_class' => $this->globalConfig['action_class']], $adminConfiguration);

        $definition = new Definition(
            $this->globalConfig['admin_class'],
            [
                $code,
                $adminConfiguration,
            ]
        );
        $definition->addTag('sidus.admin');
        $definition->setPublic(false);
        $container->setDefinition('sidus_admin.admin.'.$code, $definition);
    }
1168362
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->tokenStorageService)) {
            return;
        }
        $tokenStorage = new Reference($this->tokenStorageService);

        $commands = [
            ExecuteTaskCommand::class,
            ReducePathCommand::class,
            GeneratePathCommand::class,
            ReduceBugCommand::class,
            CaptureScreenshotsCommand::class,
        ];
        foreach ($commands as $command) {
            $commandDefinition = $container->getDefinition($command);
            $commandDefinition->addMethodCall('setTokenStorage', [$tokenStorage]);
        }
    }
1186639
public function process(ContainerBuilder $container)
    {
        $menuManagerDefinition = $container->getDefinition('joomla.admin.menu_manager');

        $adminMenus = $container->findTaggedServiceIds('joomla.admin_menu');
        $references = array();

        foreach ($adminMenus as $id => $dummy) {
            $references[] = new Reference($id);
        }

        $menuManagerDefinition->addArgument($references);

    }
784486
public function configureCdnAdapter(ContainerBuilder $container, array $config): void
    {
        if ($container->hasDefinition('bkstg.core.cdn.private_do_spaces') && isset($config['cdn'])) {
            $container
                ->getDefinition('bkstg.core.cdn.private_do_spaces')
                ->replaceArgument(0, $config['cdn']['bucket'])
                ->replaceArgument(1, new Reference($config['cdn']['client']))
            ;
        } else {
            $container->removeDefinition('bkstg.core.cdn.private_do_spaces');
        }
    }
59215
public function getAdmin(string $code): Admin
    {
        if (empty($this->admins[$code])) {
            throw new UnexpectedValueException("No admin with code: {$code}");
        }

        return $this->admins[$code];
    }
435761
public function bindParameters(ContainerBuilder $container, $name, $config) {
        if (is_array($config) && empty($config[0])) {
            foreach ($config as $key => $value) {
                $this->bindParameters($container, $name . '.' . $key, $value);
            }
        } else {
            $container->setParameter($name, $config);
        }
    }
53523
protected function getManagedClass(Definition $admin, ContainerBuilder $container)
    {
        return $container->getParameterBag()->resolveValue($admin->getArgument(1));
    }
612299
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
    {
        if (!$container->hasDefinition("thelia.admin.resources")) {
            return;
        }

        /** @var \Symfony\Component\DependencyInjection\Definition $adminResources */
        $adminResources = $container->getDefinition("thelia.admin.resources");

        $adminResources->addMethodCall("addModuleResources", [$this->getResources(), $this->getModuleCode()]);
    }
233386
public function process(ContainerBuilder $container)
    {
        $this->container = $container;

        foreach ($container->getDefinitions() as $id => $definition) {
            if ($definition->isSynthetic() || $definition->isAbstract()) {
                continue;
            }

            $this->currentId = $id;

            $this->validateReferences($definition->getArguments());
            $this->validateReferences($definition->getMethodCalls());
            $this->validateReferences($definition->getProperties());
        }
    }
1077181
public function configureCache(ContainerBuilder $container, array $config)
    {
        if (isset($config['caches']['esi'])) {
            $container
                ->getDefinition('sonata.page.cache.esi')
                ->replaceArgument(0, $config['caches']['esi']['token'])
                ->replaceArgument(1, $config['caches']['esi']['servers'])
                ->replaceArgument(3, 3 === $config['caches']['esi']['version'] ? 'ban' : 'purge');
        } else {
            $container->removeDefinition('sonata.page.cache.esi');
        }

        if (isset($config['caches']['ssi'])) {
            $container
                ->getDefinition('sonata.page.cache.ssi')
                ->replaceArgument(0, $config['caches']['ssi']['token']);
        } else {
            $container->removeDefinition('sonata.page.cache.ssi');
        }
    }
399140
public function load(array $configs, ContainerBuilder $container): void
    {
        $processor = new Processor();
        $configuration = new Configuration();
        $config = $processor->processConfiguration($configuration, $configs);

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

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

        $bundles = $container->getParameter('kernel.bundles');

        if (isset($bundles['FOSCKEditorBundle'])) {
            $loader->load('form.xml');
        }

        if (isset($bundles['SonataBlockBundle'])) {
            $loader->load('block.xml');
        }

        if (isset($bundles['SonataMediaBundle'])) {
            $loader->load('ckeditor.xml');
        }

        if (!\array_key_exists($config['default_formatter'], $config['formatters'])) {
            throw new \InvalidArgumentException(sprintf(
                'SonataFormatterBundle - Invalid default formatter: %s, available: %s',
                $config['default_formatter'],
                sprintf('["%s"]', implode('", "', array_keys($config['formatters'])))
            ));
        }

        $pool = $container->getDefinition('sonata.formatter.pool');
        $pool->addArgument($config['default_formatter']);

        foreach ($config['formatters'] as $code => $configuration) {
            if (0 === \count($configuration['extensions'])) {
                $env = null;
            } else {
                $env = new Reference($this->createEnvironment(
                    $container,
                    $code,
                    $configuration['extensions']
                ));
            }

            $pool->addMethodCall(
                'add',
                [$code, new Reference($configuration['service']), $env]
            );
        }

        $container->setParameter(
            'sonata.formatter.ckeditor.configuration.templates',
            $config['ckeditor']['templates']
        );
    }
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]);
        }
    }
175960
public function load(array $configs, ContainerBuilder $container): void
    {
        $this->globalConfig = $this->processConfiguration($this->createConfiguration(), $configs);

        $container->setParameter(
            'sidus_admin.templating.fallback_template_directory',
            $this->globalConfig['fallback_template_directory']
        );

        foreach ((array) $this->globalConfig['configurations'] as $code => $adminConfiguration) {
            $this->createAdminServiceDefinition($code, $adminConfiguration, $container);
        }

        parent::load($configs, $container);
    }
1336956
public function createActionConfiguration(
        string $actionName,
        array $configuration,
        string $adminName,
        AdminConfiguration $adminConfiguration
    ): ActionConfiguration {
        $event = new ConfigurationEvent(
            $actionName,
            $adminConfiguration->getParameter('actions'),
            $adminName,
            $adminConfiguration->getParameter('entity')
        );
        $this->eventDispatcher->dispatch(Events::CONFIGURATION_ACTION, $event);

        $resolver = new OptionsResolver();
        $actionConfiguration = new ActionConfiguration($actionName, $adminName, $adminConfiguration);
        $actionConfiguration->configureOptions($resolver);
        $actionConfiguration->setParameters($resolver->resolve($configuration));

        return $actionConfiguration;
    }
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);
    }
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;
            }
        }
    }
766197
public function configureClass($config, ContainerBuilder $container)
    {
        // admin configuration
        $container->setParameter('networking_init_cms.admin.page.class', $config['class']['page']);
        $container->setParameter('networking_init_cms.admin.layout_block.class', $config['class']['layout_block']);
        $container->setParameter('networking_init_cms.admin.user.class', $config['class']['user']);

        // manager configuration
        $container->setParameter('networking_init_cms.manager.page.class', $config['class']['page']);
        $container->setParameter('networking_init_cms.manager.layout_block.class', $config['class']['layout_block']);
        $container->setParameter('networking_init_cms.manager.user.class', $config['class']['user']);

        switch ($config['db_driver']) {
            case 'orm':
                $container->setParameter('networking_init_cms.admin.layout_block.class', 'Networking\InitCmsBundle\Entity\LayoutBlock');
                break;
            case 'mongodb':
                $container->setParameter('networking_init_cms.admin.layout_block.class', 'Networking\InitCmsBundle\Docment\LayoutBlock');
                break;
            default:
                throw new \InvalidArgumentException('db driver must be either orm or mongodb');
                break;
        }
    }