@param ContainerBuilder $builder
@param bool             $showHidden

@return array
971743
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden)
    {
        $definitions = [];
        $tags = $builder->findTags();
        asort($tags);

        foreach ($tags as $tag) {
            foreach ($builder->findTaggedServiceIds($tag) as $serviceId => $attributes) {
                $definition = $this->resolveServiceDefinition($builder, $serviceId);

                if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                    continue;
                }

                if (!isset($definitions[$tag])) {
                    $definitions[$tag] = [];
                }

                $definitions[$tag][$serviceId] = $definition;
            }
        }

        return $definitions;
    }
94656
public function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false) {
        debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
        self::__construct($collectHidden, $staticLabels);
    }
597870
protected function loadInternal(
        array $mergedConfig,
        ContainerBuilder $container
    )
    {
        /**
         * Setting defined parameters to services
         */
        $container->setParameter('twitter.api_key',
            $mergedConfig['twitter']['api_key']
        );

        $container->setParameter('twitter.api_secret',
            $mergedConfig['twitter']['api_secret']
        );

        $loader = new YamlFileLoader(
            $container,
            new FileLocator(__DIR__ . '/../Resources/config')
        );

        $loader->load('services.yml');
    }
444934
public function findHidden($id = null, array $relations = array())
    {
        return new Accessor\Form\HiddenAccessor($id, $relations, $this->con);
    }
10281
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['data'] || null === $options['data']->getId()) {
            $options['provider']->buildCreateForm($builder, $options);
        } else {
            $options['provider']->buildEditForm($builder, $options);
        }

        $builder->add('provider', HiddenType::class, ['data' => $options['provider']->getName()]);
    }
1132444
private function findConverters(ContainerBuilder $container)
    {
        $converters = [];

        foreach ($container->findTaggedServiceIds('fxp_resource.converter') as $serviceId => $tag) {
            $type = isset($tag[0]['type']) ? $this->getRealValue($container, $tag[0]['type']) : $this->getType($container, $serviceId);
            $converters[$type] = $container->getDefinition($serviceId);
        }

        return array_values($converters);
    }
532583
public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (!isset($bundles['GosPubSubRouterBundle'])) {
            throw new RuntimeException('The GosWebSocketBundle requires the GosPubSubRouterBundle.');
        }

        $config = $this->processConfiguration(new Configuration(), $container->getExtensionConfig($this->getAlias()));

        // GosPubSubRouterBundle
        if (isset($config['server'])) {
            $pubsubConfig = $config['server']['router'] ?? [];

            $container->prependExtensionConfig(
                'gos_pubsub_router',
                [
                    'routers' => [
                        'websocket' => $pubsubConfig,
                    ],
                ]
            );
        }

        // TwigBundle
        if (isset($bundles['TwigBundle'])) {
            if (isset($config['shared_config'], $config['server']) && $config['shared_config']) {
                $twigConfig = ['globals' => []];

                if (isset($config['server']['host'])) {
                    $twigConfig['globals']['gos_web_socket_server_host'] = $config['server']['host'];
                }

                if (isset($config['server']['port'])) {
                    $twigConfig['globals']['gos_web_socket_server_port'] = $config['server']['port'];
                }

                if (!empty($twigConfig['globals'])) {
                    $container->prependExtensionConfig('twig', $twigConfig);
                }
            }
        }

        // MonologBundle
        if (isset($bundles['MonologBundle'])) {
            $monologConfig = [
                'channels' => ['websocket'],
                'handlers' => [
                    'websocket' => [
                        'type' => 'console',
                        'verbosity_levels' => [
                            'VERBOSITY_NORMAL' => $container->getParameter('kernel.debug') ? Logger::DEBUG : Logger::INFO,
                        ],
                        'channels' => [
                            'type' => 'inclusive',
                            'elements' => ['websocket'],
                        ],
                    ],
                ],
            ];

            $container->prependExtensionConfig('monolog', $monologConfig);
        }
    }
258163
public function process(ContainerBuilder $container)
    {
        $taggedServiceIds = $container->findTaggedServiceIds('p2_ratchet.application');
        $events = array();

        foreach ($taggedServiceIds as $serviceId => $attributes) {
            $service = $container->getDefinition($serviceId);

            /** @var \P2\Bundle\RatchetBundle\WebSocket\ApplicationInterface $classname */
            $classname = $container->getParameterBag()->resolveValue($service->getClass());

            $eventList = array_keys($classname::getSubscribedEvents());
            $events = array_merge($events, $eventList);
        }

        $container
            ->getDefinition('p2_ratchet.websocket.server_bridge')
            ->addMethodCall('setAllowedEvents', array($events));
    }
960435
private function getSections($shownExtension, $shownStructure)
    {

        $sections = array();
        $user = $this->getSession()->getUser();
        $structure = MenuService::getPerspective($shownExtension, $shownStructure);
        if (!is_null($structure)) {
            foreach ($structure->getChildren() as $section) {

                $resolver = new ActionResolver($section->getUrl());
                if (FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())) {

                    foreach($section->getActions() as $action){
                        $this->propagate($action);
                        $resolver = new ActionResolver($action->getUrl());
                        if(!FuncProxy::accessPossible($user, $resolver->getController(), $resolver->getAction())){
                            $section->removeAction($action);
                        }

                    }

                    $sections[] = $section;
                }
            }
        }

        return $sections;
    }
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']);
        }
    }
642197
private function findAndValidateMappingAwareDefinitionList(ContainerBuilder $container): array
    {
        $mappingAwareServiceDefinitionList = [];
        $methodAwareServiceIdList = array_keys($container->findTaggedServiceIds(self::JSONRPC_METHOD_AWARE_TAG));
        foreach ($methodAwareServiceIdList as $serviceId) {
            $definition = $container->getDefinition($serviceId);

            $this->checkMethodAwareServiceIdList($definition, $serviceId, $container);

            $mappingAwareServiceDefinitionList[$serviceId] = $definition;
        }

        return $mappingAwareServiceDefinitionList;
    }
38991
private function getBuses(ContainerBuilder $container)
    {
        $buses = [];
        $busDefinitions = $container->findTaggedServiceIds('sokil.command_bus');
        foreach ($busDefinitions as $busServiceId => $busTags) {
            foreach ($busTags as $busTagParams) {
                $buses[$busServiceId] = $container->findDefinition($busServiceId);
            }
        }

        return $buses;
    }
1085256
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->addModelTransformer(
            new CallbackTransformer(
                function ($originalData) use ($options) {
                    if (\is_array($originalData) && $options['multiple']) {
                        foreach ($originalData as $key => $originalDatum) {
                            if ($originalDatum instanceof FamilyInterface) {
                                $originalData[$key] = $originalDatum->getCode();
                            }
                        }

                        return $originalData;
                    }
                    if ($originalData instanceof FamilyInterface) {
                        $originalData = $originalData->getCode();
                    }

                    return $originalData;
                },
                function ($submittedData) use ($options) {
                    if (null === $submittedData) {
                        return $submittedData;
                    }
                    if ($submittedData instanceof FamilyInterface) {
                        // Should actually never happen ?
                        return $submittedData;
                    }

                    if (\is_array($submittedData) && $options['multiple']) {
                        foreach ($submittedData as $key => $submittedDatum) {
                            if ($submittedDatum instanceof FamilyInterface) {
                                continue;
                            }
                            $submittedData[$key] = $this->familyRegistry->getFamily($submittedDatum);
                        }

                        return $submittedData;
                    }

                    /** @var string $submittedData */

                    return $this->familyRegistry->getFamily($submittedData);
                }
            )
        );
    }
954704
private function configureAutoDiscoveryClients(ContainerBuilder $container, array $config)
    {
        $httpClient = $config['discovery']['client'];
        if ('auto' !== $httpClient) {
            $container->removeDefinition('httplug.auto_discovery.auto_discovered_client');
            $container->removeDefinition('httplug.collector.auto_discovered_client');

            if (!empty($httpClient)) {
                $container->setAlias('httplug.auto_discovery.auto_discovered_client', $httpClient);
                $container->getAlias('httplug.auto_discovery.auto_discovered_client')->setPublic(false);
            }
        }

        $asyncHttpClient = $config['discovery']['async_client'];
        if ('auto' !== $asyncHttpClient) {
            $container->removeDefinition('httplug.auto_discovery.auto_discovered_async');
            $container->removeDefinition('httplug.collector.auto_discovered_async');

            if (!empty($asyncHttpClient)) {
                $container->setAlias('httplug.auto_discovery.auto_discovered_async', $asyncHttpClient);
                $container->getAlias('httplug.auto_discovery.auto_discovered_async')->setPublic(false);
            }
        }

        if (null === $httpClient && null === $asyncHttpClient) {
            $container->removeDefinition('httplug.strategy');

            return;
        }
    }
904410
public function getDirectories($showHidden = false)
    {
        $it = $this->getContents();

        return array_filter($it, function (HandlerInterface $handler) use ($showHidden) {
            return $handler->isDir() && ($showHidden ?: strpos($handler->getFilename(), '.') !== 0);
        });
    }
978430
public function load(array $configs, ContainerBuilder $container)
    {
        $configs[] = $this->options;
        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $container->register('security.firewall_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['firewall']);
        $container->register('security.auth_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['login_path'])
            ->addArgument(null)
            ->addArgument('POST');
        $container->register('security.logout_matcher', 'Symfony\Component\HttpFoundation\RequestMatcher')
            ->setPublic(false)
            ->addArgument($config['logout_path']);

        $authenticatorService = $this->configureAuthenticator($config['authenticator'], $container);

        $container->register('security.security_subscriber', 'Nice\Security\FirewallSubscriber')
            ->addArgument(new Reference('event_dispatcher'))
            ->addArgument(new Reference('security.firewall_matcher'))
            ->addArgument(new Reference('security.auth_matcher'))
            ->addArgument(new Reference('security.logout_matcher'))
            ->addArgument(new Reference($authenticatorService))
            ->addArgument($config['login_path'])
            ->addArgument($config['success_path'])
            ->addArgument($config['token_session_key'])
            ->addTag('kernel.event_subscriber');

        $container->register('security.auth_failure_subscriber', 'Nice\Security\AuthenticationFailureSubscriber')
            ->addTag('kernel.event_subscriber');
    }
897088
public function prepareConfig(array $config, ContainerBuilder $container)
    {
        $default = $this->getJoomlaConfig($container);

        $reset = [
            'debug',
            'log_path',
            'tmp_path',
            'secret'
        ];

        foreach ($default as $key => $value) {
            if (in_array($key, $reset)) {
                unset($default[$key]);
            }
        }

        $config = array_merge(
            $default,
            $this->getDefaultConfig(),
            $config
        );

        return $config;
    }