Completed
Push — master ( 38098f...62d62f )
by Danny
06:00
created

RestartCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
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 29
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 11 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
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
        $handler = $this->getContainer()->get('phobetor_rabbitmq_supervisor');
30
31 2
        if ($input->getOption('generate')) {
32 1
            $handler->generate();
33 1
        }
34
35 2
        $handler->stop();
36 2
        $handler->start();
37 2
    }
38
}
39