| Conditions | 6 |
| Paths | 6 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function process(ContainerBuilder $container) |
||
| 16 | { |
||
| 17 | if (!$container->hasDefinition('victoire_view_reference.transformer_chain')) { |
||
| 18 | return; |
||
| 19 | } |
||
| 20 | $definition = $container->getDefinition( |
||
| 21 | 'victoire_view_reference.transformer_chain' |
||
| 22 | ); |
||
| 23 | $taggedServices = $container->findTaggedServiceIds( |
||
| 24 | 'victoire_view_reference.transformer' |
||
| 25 | ); |
||
| 26 | foreach ($taggedServices as $id => $tagAttributes) { |
||
| 27 | foreach ($tagAttributes as $attributes) { |
||
| 28 | if (!array_key_exists('viewNamespace', $attributes)) { |
||
| 29 | throw new InvalidConfigurationException('ViewNamespace class attribute is not defined for service '.$id); |
||
| 30 | } |
||
| 31 | if (!array_key_exists('outputFormat', $attributes)) { |
||
| 32 | throw new InvalidConfigurationException('OutputFormat (xml|array) attribute is not defined for service '.$id); |
||
| 33 | } |
||
| 34 | $definition->addMethodCall( |
||
| 35 | 'addTransformer', |
||
| 36 | [new Reference($id), $attributes['viewNamespace'], $attributes['outputFormat']] |
||
| 37 | ); |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 |