| Conditions | 5 | 
| Paths | 4 | 
| Total Lines | 26 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 21 | public function process(ContainerBuilder $container): void  | 
            ||
| 22 |     { | 
            ||
| 23 |         if (!$container->hasDefinition('bitbag_sylius_cms_plugin.registry.media_provider')) { | 
            ||
| 24 | return;  | 
            ||
| 25 | }  | 
            ||
| 26 | |||
| 27 |         $providerRegistry = $container->getDefinition('bitbag_sylius_cms_plugin.registry.media_provider'); | 
            ||
| 28 | $providers = [];  | 
            ||
| 29 | |||
| 30 |         foreach ($container->findTaggedServiceIds('bitbag_sylius_cms_plugin.media_provider') as $id => $attributes) { | 
            ||
| 31 |             if (!isset($attributes[0]['type']) || !isset($attributes[0]['label'])) { | 
            ||
| 32 |                 throw new \InvalidArgumentException('Tagged media provider needs to have `type` and `label` attribute.'); | 
            ||
| 33 | }  | 
            ||
| 34 | |||
| 35 | $name = $attributes[0]['label'];  | 
            ||
| 36 | $type = $attributes[0]['type'];  | 
            ||
| 37 | |||
| 38 | $providers[$name] = $type;  | 
            ||
| 39 | |||
| 40 |             $providerRegistry->addMethodCall('register', [$type, new Reference($id)]); | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | ksort($providers);  | 
            ||
| 44 | |||
| 45 |         $container->setParameter('bitbag_sylius_cms_plugin.media_providers', $providers); | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 |