| Conditions | 4 |
| Paths | 5 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function process(ContainerBuilder $container) |
||
| 22 | { |
||
| 23 | if (!$container->has('gpslab.date.tz.resolver.collection')) { |
||
| 24 | return; |
||
| 25 | } |
||
| 26 | |||
| 27 | $resolvers = []; |
||
| 28 | foreach ($container->findTaggedServiceIds('gpslab.date.tz.resolver') as $id => $attributes) { |
||
| 29 | $resolvers[] = [ |
||
| 30 | 'id' => $id, |
||
| 31 | 'attributes' => $attributes[0], |
||
| 32 | ]; |
||
| 33 | } |
||
| 34 | |||
| 35 | usort($resolvers, function ($a, $b) { |
||
| 36 | return $this->sort($a, $b); |
||
| 37 | }); |
||
| 38 | |||
| 39 | $definition = $container->findDefinition('gpslab.date.tz.resolver.collection'); |
||
| 40 | foreach ($resolvers as $resolver) { |
||
| 41 | $definition->addMethodCall('addResolver', [new Reference($resolver['id'])]); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 59 |