Completed
Push — master ( 4c9af5...c5590c )
by Daniel
03:25
created

RpcServerPass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 2
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\DependencyInjection\Compiler;
4
5
use Cmobi\RabbitmqBundle\Rpc\RpcServer;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Definition;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class RpcServerPass implements CompilerPassInterface
12
{
13
    public function process(ContainerBuilder $container)
14
    {
15
        $definition = new Definition(RpcServer::class, [
16
            'rpcServices' => $container->getParameter('cmobi_rabbitmq.rpc_services')
17
        ]);
18
        $definition->addMethodCall('setContainer', [new Reference('service_container')]);
19
        $definition->addMethodCall('buildChannel');
20
21
        if ($container->has('logger')) {
22
            $definition->addMethodCall('setLogger', [new Reference('logger')]);
23
        }
24
        $container->setDefinition('cmobi_rabbitmq.rpc_server', $definition);
25
    }
26
}