| Conditions | 6 | 
| Paths | 9 | 
| Total Lines | 23 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 14 | 
| CRAP Score | 6 | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 23 | 2 | public function process(ContainerBuilder $container): void | |
| 24 |     { | ||
| 25 | 2 |         if (!$container->hasDefinition('php_translation.translator_service.external_translator')) { | |
| 26 | 1 | return; | |
| 27 | } | ||
| 28 | |||
| 29 | 1 |         $services = $container->findTaggedServiceIds('php_translation.external_translator'); | |
| 30 | 1 | $translators = []; | |
| 31 | 1 |         foreach ($services as $id => $tags) { | |
| 32 | 1 |             foreach ($tags as $tag) { | |
| 33 | 1 |                 if (!isset($tag['priority'])) { | |
| 34 | 1 | $tag['priority'] = 0; | |
| 35 | } | ||
| 36 | 1 | $translators[$id] = $tag['priority']; | |
| 37 | } | ||
| 38 | } | ||
| 39 | |||
| 40 | // Sort by priority | ||
| 41 | 1 | \asort($translators); | |
| 42 | |||
| 43 | 1 |         $def = $container->getDefinition('php_translation.translator_service.external_translator'); | |
| 44 | 1 |         foreach ($translators as $id => $prio) { | |
| 45 | 1 |             $def->addMethodCall('addTranslatorService', [new Reference($id)]); | |
| 46 | } | ||
| 49 |