QueueDeclareCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 2
cbo 3
dl 0
loc 41
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A configure() 0 10 1
A execute() 0 6 1
1
<?php
2
3
namespace TreeHouse\QueueBundle\Command;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use TreeHouse\QueueBundle\CacheWarmer\AmqpCacheWarmer;
9
10
class QueueDeclareCommand extends Command
11
{
12
    /**
13
     * @var AmqpCacheWarmer
14
     */
15
    private $cacheWarmer;
16
17
    /**
18
     * @param AmqpCacheWarmer $cacheWarmer
19
     */
20
    public function __construct(AmqpCacheWarmer $cacheWarmer)
21
    {
22
        parent::__construct();
23
24
        $this->cacheWarmer = $cacheWarmer;
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30
    protected function configure()
31
    {
32
        $this->setName('queue:declare');
33
        $this->setDescription('Tries to declare all known exchanges and queues');
34
        $this->setHelp(<<<HELP
35
This utility command is useful for deployments to ensure all the configured
36
exchanges and queues are created on the message broker.
37
HELP
38
        );
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    protected function execute(InputInterface $input, OutputInterface $output)
45
    {
46
        $this->cacheWarmer->warmUp('');
47
48
        $output->writeln('<info>All exchanges and queues are declared</info>');
49
    }
50
}
51