RestartCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 1
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