Conditions | 6 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | public function process(ContainerBuilder $container) |
||
19 | { |
||
20 | $definition = $container->getDefinition('leogout_seo.provider.generator'); |
||
21 | $taggedServices = $container->findTaggedServiceIds('leogout_seo.generator'); |
||
22 | $seoGenerators = []; |
||
23 | foreach ($taggedServices as $id => $tags) { |
||
24 | $generatorDefinition = $container->getDefinition($id); |
||
25 | if (!$generatorDefinition->isPublic()) { |
||
26 | throw new \InvalidArgumentException(sprintf('Seo generator services must be public, but "%s" is not.', $id)); |
||
27 | } |
||
28 | if ($generatorDefinition->isAbstract()) { |
||
29 | throw new \InvalidArgumentException(sprintf('Seo generator services cannot be abstract but "%s" is.', $id)); |
||
30 | } |
||
31 | foreach ($tags as $attributes) { |
||
32 | if (empty($attributes['alias'])) { |
||
33 | throw new \InvalidArgumentException(sprintf('Tag "leogout_seo.generator" requires an "alias" field in "%s" definition.', $id)); |
||
34 | } |
||
35 | $seoGenerators[$attributes['alias']] = $container->findDefinition($id); |
||
36 | } |
||
37 | } |
||
38 | $definition->replaceArgument(0, $seoGenerators); |
||
39 | } |
||
40 | } |
||
41 |