DynamicConsumerCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 54.55%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 9
c 2
b 0
f 1
dl 0
loc 22
ccs 6
cts 11
cp 0.5455
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A initConsumer() 0 4 1
A configure() 0 8 1
A getConsumerService() 0 3 1
1
<?php
2
3
/**
4
 * DynamicConsumerCommand
5
 * 
6
 * The context argument is passed to the consumer instance
7
 * which can decide about the queue and routings it uses.
8
 *
9
 * @author Tibor Barna <[email protected]>
10
 */
11
namespace OldSound\RabbitMqBundle\Command;
12
13
use Symfony\Component\Console\Input\InputArgument;
14
15
class DynamicConsumerCommand extends BaseConsumerCommand
16
{
17 1
    protected function configure()
18
    {
19 1
        parent::configure();
20
21
        $this
22 1
            ->setName('rabbitmq:dynamic-consumer')
23 1
            ->setDescription('Executes context-aware consumer')
24 1
            ->addArgument('context', InputArgument::REQUIRED, 'Context the consumer runs in')
25
            ;
26 1
    }
27
28
    protected function getConsumerService()
29
    {
30
        return 'old_sound_rabbit_mq.%s_dynamic';
31
    }
32
33
    protected function initConsumer($input)
34
    {
35
        parent::initConsumer($input);
36
        $this->consumer->setContext($input->getArgument('context'));
37
    }
38
}
39