@param ContainerBuilder $container

@throws Exception
502050
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->generatorService)) {
            return;
        }

        if (!$generators = $this->findTaggedServices($container, $this->generatorTag, PluginInterface::class, 'getName')) {
            throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->generatorTag, $this->generatorService));
        }

        $generatorDefinition = $container->getDefinition($this->generatorService);
        $generatorDefinition->replaceArgument(0, $generators);
    }
492409
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(new ShardingPass());
        $container->addCompilerPass(new CustomIteratorsPass());
        $container->addCompilerPass(new PackageCompilersPass());
    }
739713
public function process(ContainerBuilder $container)
    {
        $this->setFactoryAndServerClasses($container);
        parent::process($container);
        $this->setCasServerConfig($container);
    }
887154
public function process(ContainerBuilder $container): void
    {
        $collector = $container->findDefinition('fivelab.resource.serializer.context_collector');
        $services = $container->findTaggedServiceIds('resource.serializer.collector');

        foreach ($services as $serviceId => $tags) {
            try {
                $collectorDefinition = $container->getDefinition($serviceId);
                $collectorClass = $container->getParameterBag()->resolveValue($collectorDefinition->getClass());

                if (!is_a($collectorClass, SerializationContextCollectorInterface::class, true)) {
                    throw new \RuntimeException(sprintf(
                        'The serialization context collector should implement "%s".',
                        SerializationContextCollectorInterface::class
                    ));
                }

                $collector->addMethodCall('add', [
                    new Reference($serviceId),
                ]);
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf(
                    'Can\'t compile resource serialization collector with service id "%s".',
                    $serviceId
                ), 0, $e);
            }
        }
    }
665123
public function process(ContainerBuilder $container): void
    {
        $this->injectParameters($container);

        $handlerDefinition = new Definition(UdpHandler::class, [
            '%service_bus.logger.graylog.udp_host%',
            '%service_bus.logger.graylog.udp_port%',
            '%service_bus.logger.graylog.gzip%',
            '%service_bus.logger.graylog.log_level%',
        ]);

        $container->addDefinitions([UdpHandler::class => $handlerDefinition]);

        (new LoggerCompilerPass())->process($container);

        $loggerDefinition = $container->getDefinition('service_bus.logger');

        $loggerDefinition->addMethodCall(
            'pushHandler',
            [new Reference(UdpHandler::class)]
        );
    }
539426
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(new ConfigurationCompilerPass());
        $container->addCompilerPass(new VendorCompilerPass());
    }
370685
public function process(ContainerBuilder $container): void
    {
        $factoryChain = $container->findDefinition('fivelab.resource.error_presentation_factory');
        $factories = $container->findTaggedServiceIds('resource.error_presentation');

        foreach ($factories as $serviceId => $tags) {
            try {
                $factoryDefinition = $container->getDefinition($serviceId);
                $factoryClass = $container->getParameterBag()->resolveValue($factoryDefinition->getClass());

                if (!is_a($factoryClass, ErrorPresentationFactoryInterface::class, true)) {
                    throw new \RuntimeException(sprintf(
                        'The error presentation factory should implement "%s".',
                        ErrorPresentationFactoryInterface::class
                    ));
                }

                $factoryChain->addMethodCall('add', [new Reference($serviceId)]);
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf(
                    'Cannot compile error presentation factory with id "%s".',
                    $serviceId
                ), 0, $e);
            }
        }
    }
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));
    }
1267569
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->pathReducerService)) {
            return;
        }

        if (!$pathReducers = $this->findTaggedServices($container, $this->pathReducerTag, PluginInterface::class, 'getName')) {
            throw new RuntimeException(sprintf('You must tag at least one service as "%s" to use the "%s" service.', $this->pathReducerTag, $this->pathReducerService));
        }

        $pathReducerDefinition = $container->getDefinition($this->pathReducerService);
        $pathReducerDefinition->replaceArgument(0, $pathReducers);
    }
350821
public function build(ContainerBuilder $container)
    {
        parent::build($container);
        $container->addCompilerPass(new TransportCompilerPass());
        $container->addCompilerPass(new SpoolCompilerPass());
    }
245957
protected function loadExceptionListener(ContainerBuilder $container, array $config)
    {
        $definition = new Definition(
            'M6Web\Bundle\ApiExceptionBundle\EventListener\ExceptionListener',
            [
                new Reference('kernel'),
                new Reference($this->getAlias().'.manager.exception'),
                $config['match_all'],
                $config['default'],
                $config['stack_trace'],
            ]
        );

        $definition->setPublic(true);

        $definition->addTag(
            'kernel.event_listener',
            [
                'event' => 'kernel.exception',
                'method' => 'onKernelException',
                'priority' => '-100' // as the setResponse stop the exception propagation, this listener has to pass in last position
            ]
        );

        $container->setDefinition($this->getAlias().'.listener.exception', $definition);
    }
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());
    }
967242
public function prepend(ContainerBuilder $container): void
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

        $this->prependTwig($container, $loader);
    }
103283
public function process(ContainerBuilder $container)
    {
        $this->container = $container;
        $this->buildReader();
        $this->buildUseCaseProxies();
    }
622708
public function build(ContainerBuilder $container)
    {
        parent::build($container);

        $container->addCompilerPass(
            new GeneratorHashCompilerPass(),
            PassConfig::TYPE_BEFORE_OPTIMIZATION,
            50
        );
    }
942645
public function process(ContainerBuilder $container)
    {
        if ($container->hasDefinition('umenu.manager') || $container->hasAlias('umenu.manager')) {
            $eventListener = $container->getDefinition('ucms_tree.site_event_subscriber');

            $eventListener->addMethodCall(
                'setTreeManager',
                [new Reference('umenu.manager')]
            );
        }
    }
68086
public function compile(ContainerBuilder $container)
    {
        try {
            foreach ($this->passConfig->getPasses() as $pass) {
                $pass->process($container);
            }
        } catch (\Exception $e) {
            $usedEnvs = [];
            $prev = $e;

            do {
                $msg = $prev->getMessage();

                if ($msg !== $resolvedMsg = $container->resolveEnvPlaceholders($msg, null, $usedEnvs)) {
                    $r = new \ReflectionProperty($prev, 'message');
                    $r->setAccessible(true);
                    $r->setValue($prev, $resolvedMsg);
                }
            } while ($prev = $prev->getPrevious());

            if ($usedEnvs) {
                $e = new EnvParameterException($usedEnvs, $e);
            }

            throw $e;
        } finally {
            $this->getServiceReferenceGraph()->clear();
        }
    }