Conditions | 5 |
Paths | 4 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 5.0113 |
Changes | 0 |
1 | <?php |
||
25 | 9 | public function process(ContainerBuilder $container) |
|
26 | { |
||
27 | 9 | if (!$container->hasDefinition('fos_elastica.config_manager')) { |
|
28 | return; |
||
29 | } |
||
30 | |||
31 | 9 | $indexSources = []; |
|
32 | 9 | $indexTemplateSources = []; |
|
33 | 9 | foreach (array_keys($container->findTaggedServiceIds('fos_elastica.config_source')) as $id) { |
|
34 | 9 | $tag = $container->findDefinition($id)->getTag('fos_elastica.config_source'); |
|
35 | 9 | if (isset($tag[0]['source']) && $tag[0]['source'] === self::SOURCE_TYPE_INDEX_TEMPLATE) { |
|
36 | 9 | $indexTemplateSources[] = new Reference($id); |
|
37 | } else { |
||
38 | 9 | $indexSources[] = new Reference($id); |
|
39 | } |
||
40 | } |
||
41 | |||
42 | 9 | $container->getDefinition('fos_elastica.config_manager')->replaceArgument(0, $indexSources); |
|
43 | 9 | $container->getDefinition('fos_elastica.config_manager.index_templates')->replaceArgument(0, $indexTemplateSources); |
|
44 | 9 | } |
|
45 | } |
||
46 |