| Conditions | 5 |
| Paths | 5 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | public function process(ContainerBuilder $container) |
||
| 24 | { |
||
| 25 | if (!$container->hasDefinition('omnipay')) { |
||
| 26 | return; |
||
| 27 | } |
||
| 28 | |||
| 29 | $definition = $container->findDefinition('omnipay'); |
||
| 30 | |||
| 31 | $taggedGateways = $container->findTaggedServiceIds('omnipay.gateway'); |
||
| 32 | foreach ($taggedGateways as $id => $tags) { |
||
| 33 | foreach ($tags as $tag) { |
||
| 34 | $args = [new Reference($id)]; |
||
| 35 | |||
| 36 | // Reference the gateway by the alias if provided |
||
| 37 | if (isset($tag['alias'])) { |
||
| 38 | $args[] = $tag['alias']; |
||
| 39 | } |
||
| 40 | |||
| 41 | $definition->addMethodCall('registerGateway', $args); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 | } |
||
| 46 |