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
12
namespace OldSound\RabbitMqBundle\Command;
13
14
use Symfony\Component\Console\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputInterface;
16
17
class DynamicConsumerCommand extends BaseConsumerCommand
18
{
19 1
    protected function configure(): void
20
    {
21 1
        parent::configure();
22
23
        $this
24 1
            ->setName('rabbitmq:dynamic-consumer')
25 1
            ->setDescription('Executes context-aware consumer')
26 1
            ->addArgument('context', InputArgument::REQUIRED, 'Context the consumer runs in')
27
        ;
28 1
    }
29
30
    protected function getConsumerService()
31
    {
32
        return 'old_sound_rabbit_mq.%s_dynamic';
33
    }
34
35
    protected function initConsumer(InputInterface $input)
36
    {
37
        parent::initConsumer($input);
38
        $this->consumer->setContext($input->getArgument('context'));
39
    }
40
}
41