tagName = $tagName; } public function process(ContainerBuilder $container): void { $parserFactoryDefinition = $container->findDefinition(SoftReferenceParserFactory::class); foreach ($container->findTaggedServiceIds($this->tagName) as $id => $tags) { $definition = $container->findDefinition($id); if (!$definition->isAutoconfigured() || $definition->isAbstract()) { continue; } $definition->setPublic(true); foreach ($tags as $attributes) { if (!($attributes['parserKey'] ?? false)) { throw new \InvalidArgumentException( 'Service tag "softreference.parser" requires the attribute "parserKey" to be set. Missing in: ' . $id, 1628736154 ); } $parserFactoryDefinition->addMethodCall('addParser', [$definition, $attributes['parserKey']]); } } } }