RestartCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 28
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 10 2
1
<?php
2
3
namespace MyOnlineStore\Bundle\RabbitMqManagerBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
final class RestartCommand extends ContainerAwareCommand
11
{
12
    /**
13
     * @inheritdoc
14
     */
15 2
    protected function configure()
16
    {
17 2
        $this
18 2
            ->setName('rabbitmq-manager:restart')
19 2
            ->setDescription('restart supervisord')
20 2
            ->addOption('generate', null, InputOption::VALUE_NONE, 'Generate configuration files before starting')
21
        ;
22 2
    }
23
24
    /**
25
     * @inheritdoc
26
     */
27 2
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29 2
        if ($input->getOption('generate')) {
30 1
            $this->getContainer()->get('myonlinestore_rabbitmq_manager.config_generator')->generate();
31 1
        }
32
33 2
        $supervisor = $this->getContainer()->get('myonlinestore_rabbitmq_manager.supervisor');
34 2
        $supervisor->stop();
35 2
        $supervisor->start();
36 2
    }
37
}
38