Processes the ContainerBuilder to replace references to aliases with actual service references.

@param ContainerBuilder $container
345437
public function process(ContainerBuilder $container)
    {
        $this->container = $container;

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

            $definition->setArguments($this->processArguments($definition->getArguments()));
            $definition->setMethodCalls($this->processArguments($definition->getMethodCalls()));
            $definition->setProperties($this->processArguments($definition->getProperties()));
            $definition->setFactory($this->processFactory($definition->getFactory()));
        }

        foreach ($container->getAliases() as $id => $alias) {
            $aliasId = (string) $alias;
            if ($aliasId !== $defId = $this->getDefinitionId($aliasId)) {
                $container->setAlias($id, new Alias($defId, $alias->isPublic()));
            }
        }
    }
1277211
public function process(ContainerBuilder $container)
    {
        $taggedServices = $container->findTaggedServiceIds(
            self::TAG_NAME
        );

        foreach ($taggedServices as $id => $tag) {
            $definition = $container->findDefinition($id);

            $this->processTag($tag, $definition);
        }
    }
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'));
            }
        }
    }
6099
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(TaggedServices::class)) {
            return;
        }

        $manager = $container->getDefinition(TaggedServices::class);

        $definitions = $container->getDefinitions();
        foreach ($definitions as $id => $definition) {
            foreach ($definition->getTags() as $tagName => $tagAttributes) {
                $manager->addMethodCall(
                    'addSpecification',
                    [$id, $tagName, $tagAttributes[0]]
                );
            }
        }
    }
546252
public function process(ContainerBuilder $container)
    {
        // First collect all alias targets that need to be replaced
        $seenAliasTargets = [];
        $replacements = [];
        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])->setPublic($target->isPublic())->setPrivate($target->isPrivate());
            }
            // 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 (ServiceNotFoundException $e) {
                if ('' !== $e->getId() && '@' === $e->getId()[0]) {
                    throw new ServiceNotFoundException($e->getId(), $e->getSourceId(), null, [substr($e->getId(), 1)]);
                }

                throw $e;
            }
            if ($definition->isPublic()) {
                continue;
            }
            // Remove private definition and schedule for replacement
            $definition->setPublic(!$target->isPrivate());
            $definition->setPrivate($target->isPrivate());
            $container->setDefinition($definitionId, $definition);
            $container->removeDefinition($targetId);
            $replacements[$targetId] = $definitionId;
        }
        $this->replacements = $replacements;

        parent::process($container);
        $this->replacements = [];
    }
29514
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->callableServiceId)) {
            return;
        }

        if (!$container->has($this->serviceLocatorId)) {
            return;
        }

        $callableDefinition = $container->findDefinition($this->callableServiceId);
        $serviceLocatorDefinition = $container->findDefinition($this->serviceLocatorId);

        $handlers = array();
        $services = array();

        $this->collectServiceIds(
            $container,
            $this->tag,
            $this->keyAttribute,
            function ($key, $serviceId, array $tagAttributes) use (&$handlers, &$services) {
                if (isset($tagAttributes['method'])) {
                    // Symfony 3.3 supports services by classname. This interferes with `is_callable`
                    // in `ServiceLocatorAwareCallableResolver`
                    $callable = [
                        'serviceId' => $serviceId,
                        'method'    => $tagAttributes['method'],
                    ];
                } else {
                    $callable = $serviceId;
                }

                $handlers[ltrim($key, '\\')][] = $callable;
                $services[$serviceId] = new Reference($serviceId);
            }
        );

        $callableDefinition->replaceArgument(0, $handlers);
        $serviceLocatorDefinition->replaceArgument(0, $services);
    }
183960
public function process(ContainerBuilder $container)
    {
        if ($container->hasAlias('api_platform.name_converter') || !$container->hasDefinition('serializer.name_converter.metadata_aware')) {
            return;
        }

        $definition = $container->getDefinition('serializer.name_converter.metadata_aware');

        if (1 >= \count($definition->getArguments()) || null === $definition->getArgument(1)) {
            return;
        }

        $container->setAlias('api_platform.name_converter', 'serializer.name_converter.metadata_aware');
    }
787392
public function process(ContainerBuilder $container)
    {
        if (!$container->has('support_tools.system_info.output_registry')) {
            return;
        }

        $outputFormattersTagged = $container->findTaggedServiceIds('support_tools.system_info.output_format');

        $outputFormatters = [];
        foreach ($outputFormattersTagged as $id => $tags) {
            foreach ($tags as $attributes) {
                $outputFormatters[$attributes['format']] = new Reference($id);
            }
        }

        $outputFormatRegistryDef = $container->findDefinition('support_tools.system_info.output_registry');
        $outputFormatRegistryDef->setArguments([$outputFormatters]);
    }
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]);
        }
    }
323321
public function process(ContainerBuilder $container)
    {
        $this->compiler = $container->getCompiler();
        $this->formatter = $this->compiler->getLoggingFormatter();
        $this->graph = $this->compiler->getServiceReferenceGraph();

        $container->setDefinitions($this->inlineArguments($container, $container->getDefinitions(), true));
    }
94488
public function process(ContainerBuilder $container)
    {
        $this->compiler = $container->getCompiler();
        $this->formatter = $this->compiler->getLoggingFormatter();

        $container->setDefinitions($this->resolveArguments($container, $container->getDefinitions(), true));
    }
596920
public function process(ContainerBuilder $container)
    {
        foreach ($container->findTaggedServiceIds($this->baseTag) as $id => $services) {
            foreach ((array) $services as $service) {
                $this->findAndReplaceTaggedServices($id, $service, $container);
            }
        }
    }
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());
        }
    }
184579
public function process(ContainerBuilder $container): void
    {
        $loggerDefinition = $container->getDefinition('service_bus.logger');

        if (NullLogger::class === $loggerDefinition->getClass())
        {
            $loggerDefinition->setClass(Logger::class);
            $loggerDefinition->setArguments(['%service_bus.entry_point%']);
        }

        $processors = [
            PsrLogMessageProcessor::class,
            MemoryUsageProcessor::class,
            ProcessIdProcessor::class,
        ];

        foreach ($processors as $processor)
        {
            $container->addDefinitions([$processor => new Definition($processor)]);
            $loggerDefinition->addMethodCall(
                'pushProcessor',
                [new Reference($processor)]
            );
        }
    }
163704
public function process(ContainerBuilder $container)
    {
        $pool = $container->getDefinition('admin.configuration.pool');
        // get tagged services
        $configurations = array();
        foreach ($container->findTaggedServiceIds('admin.configuration') as $id => $attributes) {
            $configurations[$id] = $attributes;
        }
        $pool->addMethodCall('setConfigurations', array($configurations));
    }
805925
public function process(ContainerBuilder $container)
    {
        $this->bag = $container->getParameterBag();

        try {
            parent::process($container);

            $aliases = array();
            foreach ($container->getAliases() as $name => $target) {
                $this->currentId = $name;
                $aliases[$this->bag->resolveValue($name)] = $target;
            }
            $container->setAliases($aliases);
        } catch (ParameterNotFoundException $e) {
            $e->setSourceId($this->currentId);

            throw $e;
        }

        $this->bag->resolve();
        $this->bag = null;
    }
178182
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->serviceId)) {
            return;
        }
        $definition = $container->findDefinition($this->serviceId);
        $handlers = array();
        $this->collectServiceIds(
            $container,
            $this->tag,
            $this->keyAttribute,
            function ($key, $serviceId, array $tagAttributes) use (&$handlers) {
                if (isset($tagAttributes['method'])) {
                    $callable = [$serviceId, $tagAttributes['method']];
                } else {
                    $callable = $serviceId;
                }
                $handlers[ltrim($key, '\\')] = $callable;
            }
        );
        $definition->replaceArgument(0, $handlers);
    }