findDefinition(ModuleAccessGateRegistry::class); $gates = []; foreach ($container->findTaggedServiceIds($this->tagName) as $id => $tags) { $definition = $container->findDefinition($id); if (!$definition->isAutoconfigured() || $definition->isAbstract()) { continue; } foreach ($tags as $attributes) { $identifier = $attributes['identifier'] ?? null; if (empty($identifier)) { throw new \RuntimeException( sprintf('Module access gate %s must have an identifier', $id), 1774436662 ); } if (!is_subclass_of($container->getParameterBag()->resolveValue($definition->getClass()), ModuleAccessGateInterface::class)) { throw new \InvalidArgumentException( sprintf('Module access gate "%s" must implement ModuleAccessGateInterface', $identifier), 1774436669 ); } $gates[$identifier] = [ 'before' => GeneralUtility::trimExplode(',', $attributes['before'] ?? '', true), 'after' => GeneralUtility::trimExplode(',', $attributes['after'] ?? '', true), 'serviceName' => $id, ]; } } $orderedGates = (new DependencyOrderingService())->orderByDependencies($gates); $registryDefinition->setArgument( '$gates', array_map( static fn(array $config) => new Reference($config['serviceName']), $orderedGates ) ); } }