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

RestartCommand::configure()   A

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
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