@param ContainerBuilder $container

@throws Exception
184146
private function replaceDefaultStrategy(ContainerBuilder $container)
    {
        if (!$container->has('assets._default_package')) {
            throw new Exception('Default package does not exist.');
        }

        $defaultPackage = $container->getDefinition('assets._default_package');

        $class = $this->getPackageClass($defaultPackage, $container);

        if ($class === null) {
            throw new Exception(
                sprintf('Unable to resolve the class of the service "%s"', 'assets._default_package')
            );
        }

        $index = $this->getIndexForVersionStrategyArgument($class);

        $defaultPackage->replaceArgument(
            $index,
            new Reference('irozgar_gulp_rev_versions.asset.gulp_rev_version_strategy')
        );
    }
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);
    }
165439
public function process(ContainerBuilder $container)
    {
        if (class_exists(BaseTranslator::class) && $container->hasDefinition('translator.default')
            && $container->hasParameter('translator.class')) {
            $class = $container->getParameter('translator.class');
            $definition = $container->getDefinition('translator.default');
            $definition->setClass($class);
        }
    }
63734
public function process(ContainerBuilder $container)
    {
        $manager = $container->findDefinition(self::MANAGER_ID);

        $serviceIds = $container->findTaggedServiceIds(self::WORKER_RUNNER_TAG);
        foreach ($serviceIds as $serviceId => $tags) {
            $this->addManagerCalls($container, $manager, $serviceId, $tags);
        }
    }
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);
    }
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());
        }
    }
1057065
public function build(ContainerBuilder $container)
    {
        parent::build($container);

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

        $container->addCompilerPass(new ConnectorCompilerPass);
    }
94488
public function process(ContainerBuilder $container)
    {
        $this->compiler = $container->getCompiler();
        $this->formatter = $this->compiler->getLoggingFormatter();

        $container->setDefinitions($this->resolveArguments($container, $container->getDefinitions(), true));
    }
14660
public function process(ContainerBuilder $container)
    {
        $this->setServiceAlias( $container, HeliopsisEzFormsExtension::FACADE_SERVICE_ID );
        $this->setServiceAlias( $container, HeliopsisEzFormsExtension::FORM_PROVIDER_SERVICE_ID );
        $this->setServiceAlias( $container, HeliopsisEzFormsExtension::HANDLER_PROVIDER_SERVICE_ID );
        $this->setServiceAlias( $container, HeliopsisEzFormsExtension::RESPONSE_PROVIDER_SERVICE_ID );
    }
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;
    }
847167
public function process(ContainerBuilder $container)
    {
        $checkers = array();
        foreach ($container->findTaggedServiceIds('avoo.resource_generator.template') as $id => $attributes) {
            $checkers[$attributes[0]['type']] = $id;
        }

        $container->setParameter('avoo.resource_generator.templates', $checkers);
    }
451070
public static function read(ContainerBuilder $container)
    {
        /** @var InputInterface $input */
        $input = $container->get('input');

        $locations = [getcwd(), getcwd().'/.bldr/'];
        if ($input->hasParameterOption('--global')) {
            $locations = array_merge($locations, [getenv('HOME'), getenv('HOME').'/.bldr/']);
        }

        $locator  = new FileLocator($locations);
        $resolver = new LoaderResolver(
            [
                new Loader\YamlFileLoader($container, $locator),
                new Loader\XmlFileLoader($container, $locator),
                new Loader\PhpFileLoader($container, $locator),
                new Loader\IniFileLoader($container, $locator),
                new Loader\JsonFileLoader($container, $locator),
                new Loader\TomlFileLoader($container, $locator)
            ]
        );

        $loader      = new DelegatingLoader($resolver);
        $files       = static::findFiles($input);
        $foundConfig = false;
        foreach ($files as $file) {
            try {
                $loader->load($file);
                $foundConfig = true;
            } catch (\Exception $e) {
                if (get_class($e) !== 'InvalidArgumentException') {
                    throw $e;
                }
            }
        }

        if (!$foundConfig) {
            throw new ConfigurationFileNotFoundException(
                sprintf(
                    "Either couldn't find the configuration file, or couldn't read it. ".
                    "Make sure the extension is valid (%s). Tried: %s",
                    implode(', ', static::$TYPES),
                    implode(', ', $files)
                )
            );
        }
    }
777066
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition($this->subjectService)) {
            return;
        }

        $subjects = $this->findTaggedServices($container, $this->subjectTag, SubjectInterface::class, 'support', false);

        $subjectDefinition = $container->getDefinition($this->subjectService);
        $subjectDefinition->replaceArgument(0, $subjects);
    }
573757
public function process(ContainerBuilder $container): void
    {
        $chainVerifier = $container->findDefinition('fivelab.authorize_action.verifier');
        $verifiers = $container->findTaggedServiceIds('fivelab.authorize_action.verifier');

        foreach ($verifiers as $serviceId => $tags) {
            try {
                $definition = $container->getDefinition($serviceId);
                $class = $container->getParameterBag()->resolveValue($definition->getClass());

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

                $chainVerifier->addMethodCall('add', [
                    new Reference($serviceId),
                ]);
            } catch (\Exception $e) {
                throw new \RuntimeException(sprintf(
                    'Cannot compile authorize action verifier with service id "%s".',
                    $serviceId
                ), 0, $e);
            }
        }
    }
979932
public function process(ContainerBuilder $container)
    {
        $this->container = $container;
        $this->signalingException = new RuntimeException('Invalid reference.');

        try {
            $this->processValue($container->getDefinitions(), 1);
        } finally {
            $this->container = $this->signalingException = null;
        }
    }
243951
public function process(ContainerBuilder $container)
    {
        $builderDefinition = $container->getDefinition(ItemBuilder::class);
        $factories = $container->findTaggedServiceIds('expansion.menu.item.factory');

        foreach ($factories as $id => $tags) {
            $builderDefinition->addMethodCall(
                "addItemFactory",
                [new Reference($id)]
            );
        }
    }
245639
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(static::REGISTRY_NAME) || !$container->hasDefinition(static::EVENT_DISPATCHER_NAME)) {
            return;
        }

        $registry = $container->getDefinition(static::REGISTRY_NAME);
        $dispatcherReference = new Reference(static::EVENT_DISPATCHER_NAME);
        $parameterBag = $container->getParameterBag();

        foreach ($container->findTaggedServiceIds(static::TAG_NAME) as $id => $tags) {
            $registry->addMethodCall("addDriver", [new Reference($id)]);

            // Inject the dispatcher in the driver
            $driver = $container->getDefinition($id);
            $driver->addMethodCall("setDispatcher", [$dispatcherReference]);

            foreach ($tags as $tag) {
                if (isset($tag[static::LISTENER_TAG_PARAMETER])) {
                    $listenerCode = $parameterBag->resolveValue($tag[static::LISTENER_TAG_PARAMETER]);

                    if (!$container->hasDefinition($listenerCode)) {
                        throw new ServiceNotFoundException(sprintf("The service '%s' doesn't exist", $listenerCode));
                    }

                    $listener = $container->getDefinition($listenerCode);
                    $listenerClass = $parameterBag->resolveValue($listener->getClass());

                    $reflection = new \ReflectionClass($listenerClass);

                    if (false === $reflection->implementsInterface(static::DRIVER_LISTENER_INTERFACE)) {
                        throw new InvalidArgumentException(sprintf(
                            "The service '%s' must implement interface '%s' but doesn't",
                            $listenerCode,
                            static::DRIVER_LISTENER_INTERFACE
                        ));
                    }

                    $listener->addMethodCall("setDriver", [new Reference($id)]);
                }
            }
        }
    }