@param ContainerBuilder $container
@param ServiceConfig    $serviceConfig

@return array
180332
private function findServiceIdsByTag(ContainerBuilder $container, ServiceConfig $serviceConfig)
    {
        $tag = $serviceConfig->get(ServiceConfig::FIND_TAG);

        $serviceIds = array();

        foreach ($container->findTaggedServiceIds($tag) as $id => $services) {
            foreach ((array) $services as $service) {
                if (null === $name = $this->findName($service, $serviceConfig)) {
                    throw new \InvalidArgumentException(
                        sprintf(
                            'Service "%s" must define a name attribute like "key" or "type" for "%s" tags.',
                            $id,
                            $tag
                        )
                    );
                }

                $serviceIds[$service[$name]] = $id;
            }
        }

        return $serviceIds;
    }
1192164
public function createInstance(Container $container, ArrayResolver $serviceConfig, $serviceName)
    {
        $activator = $this->getActivator($serviceName, $serviceConfig->resolveStrict('builder'));

        return $activator->createInstance($container, $serviceConfig, $serviceName);
    }
1052506
protected function createFamilyServices(array $config, ContainerBuilder $container)
    {
        // Automatically declare a service for each family configured
        foreach ((array) $config['families'] as $code => $familyConfiguration) {
            if (empty($familyConfiguration['data_class'])) {
                $familyConfiguration['data_class'] = $config['data_class'];
            }
            if (empty($familyConfiguration['value_class'])) {
                $familyConfiguration['value_class'] = $config['value_class'];
            }
            $this->addFamilyServiceDefinition($code, $familyConfiguration, $container);
        }
    }
692233
public function load(ContainerBuilder $container, array $config)
    {
        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/config'));
        $loader->load('services.xml');

        if (!empty($config['path'])) {
            if (isset($config['path']['resources'])) {
                $container->setParameter('paths.resources.resource', $config['path']['resources']);
            }

            if (isset($config['path']['base'])) {
                $container->setParameter('paths.resources.base', $config['path']['base']);
            }
        }

        if (!empty($config['resource_map'])) {
            $container->setParameter('resource.map', $config['resource_map']);
        }
    }
1092328
public function configurePageServices(ContainerBuilder $container, array $config)
    {
        // set the default page service to use when no page type has been set. (backward compatibility)
        $definition = $container->getDefinition('sonata.page.page_service_manager');
        $definition->addMethodCall('setDefault', [new Reference($config['default_page_service'])]);
    }
237194
private function loadService($service, $serviceConfig)
    {
        list($app, $bundle, , $entity) = explode('.', $service);
        $resource = implode('.', array($app, $bundle, 'rest', $entity));

        $this->loadReadOnlyRoutes($service, $resource, $serviceConfig);
        if (!($serviceConfig[0] && array_key_exists('read-only', $serviceConfig[0]))) {
            $this->loadWriteRoutes($service, $resource, $serviceConfig);
        }
    }
765364
public function initServices(Config $config)
    {
        $serviceProviderLoader = new ServiceProviderLoader($this->getDI());
        $serviceProviderLoader->autoload(
            $config->application->serviceDir,
            $config->application->configDir
        );
    }
162558
public function load(ContainerBuilder $container, array $config)
    {
        $container->setParameter('cjm.local_webserver.configuration.host', $config['host']);
        $container->setParameter('cjm.local_webserver.configuration.port', $config['port']);
        $container->setParameter('cjm.local_webserver.configuration.docroot', $config['docroot']);
        $container->setParameter('cjm.local_webserver.configuration.suites', $config['suites']);
        $container->setParameter('cjm.local_webserver.configuration.router', $config['router']);

        $this->loadEventSubscribers($container);
        $this->loadWebserverController($container);
        $this->loadWebserverConfiguration($container, $config);
    }
22738
private function loadBundleServiceDefinitions(ContainerBuilder $container)
    {
        $fileLocator = new FileLocator(self::SERVICES_CONFIG_DIRECTORY_RELATIVE_PATH);

        $loader = new XmlFileLoader($container, $fileLocator);

        $loader->load('services.xml');
    }
646855
public function load (array $config, ContainerBuilder $container)
    {
        // parse configuration
        $parsedConfiguration = $this->processConfiguration(new Configuration(), $config);

        // load services
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');

        // build role collection
        $builder = new RoleCollectionBuilder();

        $roleCollectionDefinition = $container->getDefinition("becklyn.static_roles.role_collection");
        $roleCollectionDefinition->replaceArgument(0, $builder->prepareRoleCollection($parsedConfiguration["roles"]));
    }
725538
private function collectServiceDependencies(string $serviceClass, ContainerBuilder $container, array &$servicesReference): void
    {
        $reflectionClass = new \ReflectionClass($serviceClass);

        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod)
        {
            foreach ($reflectionMethod->getParameters() as $parameter)
            {
                if (false === $parameter->hasType())
                {
                    continue;
                }

                /** @var \ReflectionType $reflectionType */
                $reflectionType     = $parameter->getType();
                $reflectionTypeName = $reflectionType->getName();

                if (true === self::supportedType($parameter) && true === $container->has($reflectionTypeName))
                {
                    $servicesReference[$reflectionTypeName] = new ServiceClosureArgument(new Reference($reflectionTypeName));
                }
            }
        }
    }
210209
private function configurePlugins(ContainerBuilder $container, array $config)
    {
        if (!empty($config['authentication'])) {
            $this->configureAuthentication($container, $config['authentication']);
        }
        unset($config['authentication']);

        foreach ($config as $name => $pluginConfig) {
            $pluginId = 'httplug.plugin.'.$name;

            if ($this->isConfigEnabled($container, $pluginConfig)) {
                $def = $container->getDefinition($pluginId);
                $this->configurePluginByName($name, $def, $pluginConfig, $container, $pluginId);
            }
        }
    }
751413
public function getConfiguration(array $config, ContainerBuilder $container)
    {
        $configuration = new Configuration($this->getMainConfigParser(), $this->suggestionCollector);
        $configuration->setSiteAccessConfigurationFilters($this->siteaccessConfigurationFilters);

        return $configuration;
    }
190458
public function load(ContainerBuilder $container, array $config) {
        // Client initializer definition
        $clientInitializerDefinition = new Definition(
            ApiClientAwareInitializer::class,
            [
                $config['apiClient']
            ]
        );
        $clientInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Definition for the array contains comparator
        $comparatorDefinition = new Definition(ArrayContainsComparator::class);

        // Comparator initializer definition
        $comparatorInitializerDefinition = new Definition(
            ArrayContainsComparatorAwareInitializer::class,
            [
                new Reference(self::COMPARATOR_SERVICE_ID)
            ]
        );
        $comparatorInitializerDefinition->addTag(ContextExtension::INITIALIZER_TAG);

        // Add all definitions to the container
        $container->setDefinition(self::APICLIENT_INITIALIZER_SERVICE_ID, $clientInitializerDefinition);
        $container->setDefinition(self::COMPARATOR_SERVICE_ID, $comparatorDefinition);
        $container->setDefinition(self::COMPARATOR_INITIALIZER_SERVICE_ID, $comparatorInitializerDefinition);
    }
589547
public function process(ContainerBuilder $container)
    {
        $filters = [];
        foreach ($container->findTaggedServiceIds('api_platform.filter', true) as $serviceId => $tags) {
            foreach ($tags as $tag) {
                if (!isset($tag['id'])) {
                    $tag['id'] = $serviceId;
                }

                $filters[$tag['id']] = new Reference($serviceId);
            }
        }

        $container->getDefinition('api_platform.filter_locator')->addArgument($filters);
        $container->getDefinition('api_platform.filter_collection_factory')->addArgument(array_keys($filters));
    }
1216805
public function configureException(ContainerBuilder $container, array $config)
    {
        // retrieve available filters
        $filters = [];
        foreach ($config['exception']['filters'] as $name => $filter) {
            $filters[$name] = $filter;
        }

        // retrieve available renderers
        $renderers = [];
        foreach ($config['exception']['renderers'] as $name => $renderer) {
            $renderers[$name] = $renderer;
        }

        // retrieve block customization
        $blockFilters = [];
        $blockRenderers = [];
        foreach ($config['blocks'] as $service => $settings) {
            if (isset($settings['exception'], $settings['exception']['filter'])) {
                $blockFilters[$service] = $settings['exception']['filter'];
            }
            if (isset($settings['exception'], $settings['exception']['renderer'])) {
                $blockRenderers[$service] = $settings['exception']['renderer'];
            }
        }

        $definition = $container->getDefinition('sonata.block.exception.strategy.manager');
        $definition->replaceArgument(1, $filters);
        $definition->replaceArgument(2, $renderers);
        $definition->replaceArgument(3, $blockFilters);
        $definition->replaceArgument(4, $blockRenderers);

        // retrieve default values
        $defaultFilter = $config['exception']['default']['filter'];
        $defaultRenderer = $config['exception']['default']['renderer'];
        $definition->addMethodCall('setDefaultFilter', [$defaultFilter]);
        $definition->addMethodCall('setDefaultRenderer', [$defaultRenderer]);
    }
700238
public function load(array $config, ContainerBuilder $container)
    {
        $rClass = new \ReflectionClass($this);

        $yamlLoader = new YamlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $xmlLoader = new XmlFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $phpLoader = new PhpFileLoader(
            $container,
            new FileLocator(dirname($rClass->getFileName()) . '/Resources/config')
        );

        $this->registerCustom($container, $config);
        $this->registerConfigFiles($yamlLoader);
        $this->registerYamlConfigFiles($yamlLoader);
        $this->registerXmlConfigFiles($xmlLoader);
        $this->registerPhpConfigFiles($phpLoader);
        $this->registerCompilerPasses($container);

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

        $this->registerCommands($application);

        /** @var TemplatingServiceInterface $templatingService */
        $templatingService = $container->get('common.services.templating');
        $this->registerTemplates($templatingService);
    }