Replace Clean installer with CoreInstaller if required SchemaBuilder from DoctrineSchemaBundle is available.

@param \Symfony\Component\DependencyInjection\ContainerBuilder $container

@throws \Exception
167137
public function process(ContainerBuilder $container)
    {
        if (!$container->hasAlias(SchemaBuilder::class)
            || !$container->hasDefinition(self::CLEAN_INSTALLER_DEF_ID)
        ) {
            return;
        }

        $cleanInstallerDefinition = $container->getDefinition(self::CLEAN_INSTALLER_DEF_ID);
        $cleanInstallerDefinition->setClass(CoreInstaller::class);
        $cleanInstallerDefinition->addArgument(new Reference(SchemaBuilder::class));
    }
1057065
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->registerExtension(new CoralCoreExtension());

        $container->addCompilerPass(new ConnectorCompilerPass);
    }
313259
public function process(ContainerBuilder $container)
    {
        $commands = $container->findTaggedServiceIds(
            'cli.command'
        );

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

        foreach (array_keys($commands) as $id) {
            /** @var Command $command */
            $command = $container->get($id);

            if ($command instanceof ConditionalUseInterface) {
                /** @var ConditionalUseInterface $command */
                if (true !== $command->isUsable()) {
                    continue;
                }
            }

            $application->add($command);
        }
    }
46718
public function process(ContainerBuilder $container)
    {
        $fileSytem = new Filesystem(new Local(realpath($container->getParameter('kernel.root_dir') . "/../var")));
        $fileSytem->createDir('expansion');
        $fileSytem = new Filesystem(new Local(realpath($container->getParameter('kernel.root_dir') . "/../var/expansion")));

        $this->fetchDataFromRemote($fileSytem, $container);

        if ($fileSytem->has(self::MAPPINGS_FILE)) {
            $data = json_decode($fileSytem->read(self::MAPPINGS_FILE), true);
            if ($data) {
                $values = [];
                foreach ($data as $titleId => $titleInformation) {
                    $values[$titleId] = $titleInformation['game'];
                }

                $container->setParameter("expansion.storage.gamedata.titles", $values);
            }
        }
    }
1267839
protected function overrideEntities(ContainerBuilder $container)
    {
        $plugins = $this->getInstalledPluginBundles($this->kernel);

        foreach ($plugins as $plugin) {
            $configuration = $this->processPlugin($plugin);
            foreach ($configuration as $name => $config) {
                $container
                    ->prependExtensionConfig(
                        $name,
                        $config
                    );
            }
        }

        return $this;
    }
1212282
public function process(ContainerBuilder $container)
    {
        // Setup
        $this->compiler = $container->getCompiler();
        $this->formatter = $this->compiler->getLoggingFormatter();
        // First collect all alias targets that need to be replaced
        $seenAliasTargets = array();
        $replacements = array();
        foreach ($container->getAliases() as $definitionId => $target) {
            $targetId = (string) $target;
            // Special case: leave this target alone
            if ('service_container' === $targetId) {
                continue;
            }
            // Check if target needs to be replaces
            if (isset($replacements[$targetId])) {
                $container->setAlias($definitionId, $replacements[$targetId]);
            }
            // No need to process the same target twice
            if (isset($seenAliasTargets[$targetId])) {
                continue;
            }
            // Process new target
            $seenAliasTargets[$targetId] = true;
            try {
                $definition = $container->getDefinition($targetId);
            } catch (InvalidArgumentException $e) {
                throw new InvalidArgumentException(sprintf('Unable to replace alias "%s" with actual definition "%s".', $definitionId, $targetId), null, $e);
            }
            if ($definition->isPublic()) {
                continue;
            }
            // Remove private definition and schedule for replacement
            $definition->setPublic(true);
            $container->setDefinition($definitionId, $definition);
            $container->removeDefinition($targetId);
            $replacements[$targetId] = $definitionId;
        }

        // Now replace target instances in all definitions
        foreach ($container->getDefinitions() as $definitionId => $definition) {
            $definition->setArguments($this->updateArgumentReferences($replacements, $definitionId, $definition->getArguments()));
            $definition->setMethodCalls($this->updateArgumentReferences($replacements, $definitionId, $definition->getMethodCalls()));
            $definition->setProperties($this->updateArgumentReferences($replacements, $definitionId, $definition->getProperties()));
            $definition->setFactory($this->updateFactoryReference($replacements, $definition->getFactory()));
        }
    }
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;
            }
        }
    }
857663
public function build(ContainerBuilder $container)
    {
        $this->initAdmingeneratorClassLoader($container);

        parent::build($container);

        $container->addCompilerPass(new ValidatorCompilerPass());
        $container->addCompilerPass(new FormCompilerPass());
    }
521863
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        /**
         * Adds compiler pass.
         */
        $container
            ->addCompilerPass(new MappingCompilerPass())
            ->addCompilerPass(new ContextCompilerPass())
            ->addCompilerPass(new ExpressionLanguageCompilerPass());
    }
226991
public function process(ContainerBuilder $container): void
    {
        $resolver = $container->findDefinition('fivelab.resource.serializer_resolver');
        $services = $container->findTaggedServiceIds('resource.serializer');

        foreach ($services as $serviceId => $tags) {
            try {
                $attributes = $tags[0];

                if (!array_key_exists('supportable', $attributes)) {
                    throw new \RuntimeException('The resource serializer should define with supportable instance. Please add the "supportable" attribute to "resource.assembler".');
                }

                $serializerDefinition = $container->getDefinition($serviceId);
                $serializerClass = $container->getParameterBag()->resolveValue($serializerDefinition->getClass());

                if (!is_a($serializerClass, ResourceSerializerInterface::class, true)) {
                    throw new \RuntimeException(sprintf(
                        'The resource serializer should implement "%s".',
                        ResourceSerializerInterface::class
                    ));
                }

                $supportableServiceId = $attributes['supportable'];

                $resolver->addMethodCall('add', [
                    new Reference($supportableServiceId),
                    new Reference($serviceId),
                ]);
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf(
                    'Can\'t compile resource serializer with service id "%s".',
                    $serviceId
                ), 0, $e);
            }
        }
    }
1255999
public function prepend(ContainerBuilder $container)
    {
        // get all bundles
        $bundles = $container->getParameter('kernel.bundles');
        // determine if StofDoctrineExtensionsBundle is registered
        if (isset($bundles['StofDoctrineExtensionsBundle'])) {
            foreach ($container->getExtensions() as $name => $extension) {
                switch ($name) {
                    case 'stof_doctrine_extensions':
                        $configs = $container->getExtensionConfig('stof_doctrine_extensions');
                        if (isset($configs[0])) {
                            if (isset($configs[0]['orm'])) {
                                if ($configs[0]['orm']['default']) {
                                    $configs[0]['orm']['default']['timestampable'] = true;
                                } else {
                                    $configs[0]['orm']['default'] = ['timestampable' => true];
                                }
                            } else {
                                $configs[0]['orm'] = ['default' => ['timestampable' => true]];
                            }
                        } else {
                            $configs = ['orm' => ['default' => ['timestampable' => true]]];
                        }
                        if (isset($configs[0]['orm'])) {
                            $container->prependExtensionConfig($name, $configs[0]);
                        }
                        break;
                }
            }
        }
    }
964313
public function process(ContainerBuilder $container)
    {
        $compiler = $container->getCompiler();
        $formatter = $compiler->getLoggingFormatter();

        foreach ($container->getDefinitions() as $id => $definition) {
            if ($definition->isAbstract()) {
                $container->removeDefinition($id);
                $compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'abstract'));
            }
        }
    }
620887
public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (true === isset($bundles['TwigBundle'])) {
            $this->configureTwigBundle($container);
        }
        if (true === isset($bundles['FMElfinderBundle'])) {
            $this->configureFMElfinderBundle($container);
        }
    }
471272
private function addRegisterMappingsPass(ContainerBuilder $container)
    {
        $mappings = array(
            realpath(__DIR__ . '/Resources/config/doctrine/model') => 'Silvestra\Component\Media\Model',
        );

        $ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
        if (class_exists($ormCompilerClass)) {
            $container->addCompilerPass(DoctrineOrmMappingsPass::createXmlMappingDriver($mappings));
        }
    }
1334978
public function process(ContainerBuilder $container)
    {
        $configs = $container->getExtensionConfig('nova_ezseo');

        //@todo: How to do that by SiteAccess
        if (isset($configs[0]['system']['default']['custom_fallback_service'])) {
            $fallbackService = $configs[0]['system']['default']['custom_fallback_service'];
            if ($fallbackService !== null) {
                $container->getDefinition('novactive.novaseobundle.twig_extension')->addMethodCall(
                    "setCustomFallbackService",
                    [new Reference($fallbackService)]
                );
            }
        }
    }
695216
public function process(ContainerBuilder $container)
    {
        $this->container = $container;
        $this->processorDefinitionsRegistry = $this->container->getDefinition('smartesb.registry.processor_definitions');

        $processorDefinitionsServices = $container->findTaggedServiceIds(self::TAG_DEFINITIONS);
        foreach ($processorDefinitionsServices as $id => $tags) {
            foreach ($tags as $attributes) {
                $this->processorDefinitionsRegistry->addMethodCall('register', [$attributes['nodeName'], new Reference($id)]);
            }
        }

        /** @var SmartboxIntegrationCamelConfigExtension $extension */
        $extension = $container->getExtension('smartbox_integration_camel_config');

        /** @var SmartboxIntegrationFrameworkExtension $frameworkExtension */
        $frameworkExtension = $container->getExtension('smartbox_integration_framework');

        $flowsDirs = $extension->getFlowsDirectories();
        $currentVersion = $frameworkExtension->getFlowsVersion();
        $frozenFlowsDir = $extension->getFrozenFlowsDirectory();

        // Load current version if not frozen
        if (!file_exists($frozenFlowsDir.'/'.$currentVersion)) {
            $this->loadFlowsFromPaths($currentVersion, $flowsDirs);
        }

        // Load frozen versions
        $finder = new Finder();
        $frozenDirs = $finder->directories()->in($frozenFlowsDir)->depth(0);

        /** @var SplFileInfo $frozenDir */
        foreach ($frozenDirs as $frozenDir) {
            $subFinder = new Finder();
            $version = $frozenDir->getRelativePathname();
            $subDirs = $subFinder->directories()->in($frozenDir->getRealPath())->depth(0);

            $paths = [];
            /** @var SplFileInfo $subDir */
            foreach ($subDirs as $subDir) {
                $paths[] = $subDir->getRealPath();
            }

            $this->loadFlowsFromPaths($version, $paths);
        }
    }
340604
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(new VersionCompilerPass(new PrettyVersions()));
        $container->addCompilerPass(new EnvParametersCompilerPass());
        $container->addCompilerPass(new RouteLoaderCompilerPass());
        $container->addCompilerPass(new HttpClientOptionsCompilerPass());
    }