Conditions | 4 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
31 | public function process(ContainerBuilder $container) |
||
32 | { |
||
33 | if (!$container->hasDefinition('lin3s_knowledge_base.registry.generator')) { |
||
34 | return; |
||
35 | } |
||
36 | $registry = $container->getDefinition('lin3s_knowledge_base.registry.generator'); |
||
37 | foreach ($container->findTaggedServiceIds('lin3s_knowledge_base.generator') as $id => $attributes) { |
||
38 | if (!isset($attributes[0]['label'])) { |
||
39 | throw new \InvalidArgumentException('Tagged generator needs to have `label` attribute.'); |
||
40 | } |
||
41 | $name = $attributes[0]['label']; |
||
42 | $registry->addMethodCall('add', [$name, new Reference($id)]); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 |