Conditions | 7 |
Paths | 6 |
Total Lines | 27 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
28 | 4 | public function process(ContainerBuilder $container) |
|
29 | { |
||
30 | |||
31 | 4 | if (!$container->hasParameter('run_open_code.exchange_rate.repository')) { |
|
32 | 1 | return; |
|
33 | } |
||
34 | |||
35 | 3 | $repository = $container->getParameter('run_open_code.exchange_rate.repository'); |
|
36 | |||
37 | 3 | if ($container->has($repository)) { |
|
38 | 1 | $container->setAlias('run_open_code.exchange_rate.repository', $repository); |
|
39 | 1 | return; |
|
40 | } |
||
41 | |||
42 | 2 | foreach ($container->findTaggedServiceIds('run_open_code.exchange_rate.repository') as $id => $tags) { |
|
43 | |||
44 | 1 | foreach ($tags as $attributes) { |
|
45 | |||
46 | 1 | if (isset($attributes['alias']) && $repository === $attributes['alias']) { |
|
47 | 1 | $container->setDefinition('run_open_code.exchange_rate.repository', $container->findDefinition($id)); |
|
48 | 1 | return; |
|
49 | } |
||
50 | } |
||
51 | } |
||
52 | |||
53 | 1 | throw new ServiceNotFoundException(sprintf('Repository service "%s" does not exists.', $repository)); |
|
54 | } |
||
55 | } |
||
56 |