Recursively collects all posted data

@param ContainerInterface $container
@param array $data
9364
protected function getElementData(
        ContainerInterface $container, &$data = []
    ) {
         foreach ($container as $element) {
             if ($element instanceof InputInterface) {
                 $data[$element->getName()] = $element->getValue();
                 continue;
             }

             if ($element instanceof ContainerInterface) {
                 $this->getElementData($element, $data);
                 continue;
             }
        }
    }
724701
public function process(ContainerBuilder $container)
    {
        $repositoryConfigurations = $container->getParameter('apisearch.repository_configuration');
        foreach ($repositoryConfigurations as $name => $repositoryConfiguration) {
            $this->createAppRepositories(
                $container,
                $name,
                $repositoryConfiguration
            );

            foreach ($repositoryConfiguration['indices'] as $indexName => $indexId) {
                $indexId = (string) $indexId;
                $this->createIndexRepositories(
                    $container,
                    $name,
                    $repositoryConfiguration,
                    $indexId,
                    $indexName
                );
            }
        }
    }
461173
public function process(ContainerBuilder $container)
    {
        if (!$container->has($this->getCollectorServiceName())) {
            return;
        }

        $definition = $container->findDefinition(
            $this->getCollectorServiceName()
        );

        $taggedServices = $this->findAndSortTaggedServices(
            $this->getTagName(),
            $container
        );

        /*
         * Per each service, add a new method call reference
         */
        foreach ($taggedServices as $service) {
            $definition->addMethodCall(
                $this->getCollectorMethodName(),
                [$service]
            );
        }
    }
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]);
        }
    }
787991
public function process(ContainerBuilder $container)
    {
        if (!$container->has(PluginManager::class)) {
            return;
        }

        $pluginsData = [];

        // Find all Plugin services.
        $plugins = $container->findTaggedServiceIds('expansion.plugin');
        foreach ($plugins as $id => $tags) {
            $pluginsData[$id]['dataProviders'] = [];
            foreach ($tags as $attributes) {
                if (isset($attributes['data_provider'])) {
                    $pluginsData[$id]['dataProviders'][] = $attributes['data_provider'];
                }
            }
        }

        // Find the parent services.
        $plugins = $container->findTaggedServiceIds('expansion.plugin.parent');
        foreach ($plugins as $id => $tags) {
            foreach ($tags as $attributes) {
                $pluginsData[$id]['parent'][] = $attributes['parent'];
            }
        }

        // Get the data provider manager service definition to register data providers into.
        $definition = $container->getDefinition(PluginManager::class);

        foreach ($pluginsData as $pluginId => $data)
        {
            $definition->addMethodCall('registerPlugin', [
                    $pluginId,
                    empty($data['dataProviders']) ? [] : $data['dataProviders'],
                    empty($data['parent']) ? [] : $data['parent'],
                ]
            );
        }
    }
673804
static public function run(ContainerInterface $container)
    {
        $request = ServerRequestFactory::fromGlobals();
        $container->set('Request', $request);
        $response = $container->get('HttpDispatcher')->dispatch($request);

        if (is_null($response)) {
            $controller = new Controller($container);
            $response = new TextResponse('Internal server error. Dispatcher returned null response.', 500);
        }

        (new SapiEmitter())->emit($response);
    }
1165327
public static function create($data)
    {
        if (!$data) {
            return new self(self::COLLECTION_NAME);
        }

        $type = null;
        if (isset($data[self::COLLECTION_NAME])) {
            $type = self::COLLECTION_NAME;
        } elseif (isset($data[self::CONDITION_NAME])) {
            $type = self::CONDITION_NAME;
        }
        if (null === $type) {
            throw new ContainerException(
                sprintf('Invalid container type. Use %s', implode(' or ', self::ALLOWED_TYPES))
            );
        }
        if (!is_array($data[$type])) {
            throw new ContainerException(sprintf('Parameter "%s" must be array', $type));
        }
        /** @var Container $mainContainer */
        $mainContainer = new self($type);
        if (isset($data[self::AND_OR_OPERATOR_NAME])) {
            $mainContainer->setAndOr($data[self::AND_OR_OPERATOR_NAME]);
        }
        if (self::COLLECTION_NAME === $type) {
            foreach ($data[$type] as $datum) {
                $mainContainer->addToCollection(self::create($datum));
            }
        } elseif (self::CONDITION_NAME === $type) {
            $mainContainer->getCondition()->setData($data[$type]);
        }

        return $mainContainer;
    }
643925
public function create($id, ContainerInterface $container)
    {
        if (isset($this->registeredList['services'][$id])) {
            $data = $this->createService($id, $container);
        } elseif (isset($this->registeredList['params'][$id])) {
            $data = $this->registeredList['params'][$id];
        } else {
            $data = null;
        }

        return $data;
    }
313259
public function process(ContainerBuilder $container)
    {
        $commands = $container->findTaggedServiceIds(
            'cli.command'
        );

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

        foreach (array_keys($commands) as $id) {
            /** @var Command $command */
            $command = $container->get($id);

            if ($command instanceof ConditionalUseInterface) {
                /** @var ConditionalUseInterface $command */
                if (true !== $command->isUsable()) {
                    continue;
                }
            }

            $application->add($command);
        }
    }
137134
protected function parseDataProvider(ContainerInterface $container)
    {
        // Parse data provider.
        if ($container->hasDataProviderDefinition()) {
            $config = $container->getDataProviderDefinition();
        } else {
            $config = new DefaultDataProviderDefinition();
            $container->setDataProviderDefinition($config);
        }

        // First check if we are using the "new" notation used in DcGeneral 0.9.
        if (!\is_array($this->getFromDca('dca_config/data_provider'))) {
            return;
        }

        $dataProvidersDca = $this->getFromDca('dca_config/data_provider');

        foreach ($dataProvidersDca as $dataProviderDcaName => $dataProviderDca) {
            $providerInformation = $this->parseSingleDataProvider(
                $container,
                $config,
                $dataProviderDca,
                $dataProviderDcaName
            );

            if ($providerInformation instanceof ContaoDataProviderInformation) {
                $initializationData     = (array) $providerInformation->getInitializationData();
                $baseInitializationData = [
                    'name' => $dataProviderDcaName
                ];

                switch ((string) $dataProviderDcaName) {
                    case 'default':
                        $providerInformation->setVersioningEnabled(
                            (bool) $this->getFromDca('config/enableVersioning')
                        );

                        $container->getBasicDefinition()->setDataProvider($providerInformation->getName());
                        $baseInitializationData['name'] = $providerInformation->getName();
                        break;

                    case 'root':
                        $container->getBasicDefinition()->setRootDataProvider($providerInformation->getName());
                        $baseInitializationData['name'] = $providerInformation->getName();
                        break;

                    case 'parent':
                        $container->getBasicDefinition()->setParentDataProvider($providerInformation->getName());
                        $baseInitializationData['name'] = $providerInformation->getName();
                        break;

                    default:
                }

                $providerInformation->setInitializationData(
                    \array_merge(
                        $baseInitializationData,
                        $dataProviderDca,
                        $initializationData
                    )
                );
            }
        }
    }
681391
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())
            );

            $calls = array();
            foreach ($definition->getMethodCalls() as $call) {
                try {
                    $calls[] = array($call[0], $this->processArguments($call[1], true));
                } catch (RuntimeException $e) {
                    // this call is simply removed
                }
            }
            $definition->setMethodCalls($calls);

            $properties = array();
            foreach ($definition->getProperties() as $name => $value) {
                try {
                    $value = $this->processArguments(array($value), true);
                    $properties[$name] = reset($value);
                } catch (RuntimeException $e) {
                    // ignore property
                }
            }
            $definition->setProperties($properties);
        }
    }
431093
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition(static::TASK_REGISTRY)) {
            return;
        }

        $registry = $container->getDefinition(static::TASK_REGISTRY);

        foreach ($container->findTaggedServiceIds(static::TASK_TAG) as $id => $tag) {
            $registry->addMethodCall("addTask", [new Reference($id)]);
        }
    }
537116
private function duplicateFlashMessengerSessionData(Container $container) : void
    {
        $flashToolbarContainer = new Container('SanSessionToolbarFlashMessenger');
        foreach ($container->getArrayCopy() as $key => $row) {
            foreach ($row->toArray() as $keyArray => $rowArray) {
                if ($keyArray === 0) {
                    $flashToolbarContainer->$key = new SplQueue();
                }
                $flashToolbarContainer->$key->push($rowArray);
            }
        }
    }
731184
public function process(ContainerBuilder $container): void
    {
        if (!$container->hasDefinition(Aggregator::class)) {
            return;
        }

        $aggregatorDefinition = $container->getDefinition(Aggregator::class);
        $taggedServiceIds = $container->findTaggedServiceIds(self::TAG_CONFIG_PROVIDER);

        foreach ($taggedServiceIds as $taggedServiceId => $tags) {
            foreach ($tags as $tag) {
                $key = $tag['key'] ?? $taggedServiceId;
                $aggregatorDefinition->addMethodCall('addProvider', [$key, new Reference($taggedServiceId)]);
            }
        }
    }
1280435
protected function mapRequestDataToElement($data, ElementInterface $child)
    {
        $child->setValue($data);
        $children = $child->getChildren();

        if ($children->count()) {
            $this->mapRequestDataToElementCollection($data, $children);
        }
    }
1287490
public function create($containerOrName, array $data = [])
    {
        // Check if parent or name is defined
        if (!(
            $containerOrName instanceof Model\ContainerInterface ||
            (is_string($containerOrName) && 0 < strlen($containerOrName))
        )
        ) {
            throw new InvalidOperationException("Excepted instance of ContainerInterface or string.");
        }

        // New instance
        $row = $this->editor->getRepository()->createRow();

        // Create default block
        $this->editor->getBlockManager()->create($row);

        // Add to row if available
        if ($containerOrName instanceof Model\ContainerInterface) {
            $count = $containerOrName->getRows()->count();
            $row->setPosition($count);
            $containerOrName->addRow($row);
        } else {
            $row->setName($containerOrName);
        }

        return $row;
    }
122031
protected function getPages(ContainerInterface $container)
	{
		if (null === $this->pages) 
		{
			$siteMainId = 0;
			
			$melisPage = $this->serviceLocator->get('MelisEnginePage');
			$actualPage = $melisPage->getDatasPage($this->idpage);
			if ($actualPage)
			{
				$siteId = 0;
				$datasTemplate = $actualPage->getMelisTemplate();
				if (!empty($datasTemplate->tpl_site_id))
					$siteId = $datasTemplate->tpl_site_id;
				
				if (!empty($siteId) && $siteId > 0)
				{
					$melisTableSite = $this->serviceLocator->get('MelisEngineTableSite');
					$datasSite = $melisTableSite->getSiteById($siteId, getenv('MELIS_PLATFORM'));
					if (!empty($datasSite))
					{
						$datasSite = $datasSite->toArray();
						if (count($datasSite) > 0)
							$siteMainId = $datasSite[0]['site_main_page_id'];
					}
				}
			}

			$navigation = $this->getChildrenRecursive($siteMainId);
			
			$pages      = $this->getPagesFromConfig($navigation);
	
			$this->pages = $this->injectComponents(
					$pages
			);
		}
		
		return $this->pages;
	}