GenCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 6
nc 1
nop 2
1
<?php
2
3
namespace Ivan1986\SupervisorBundle\Command;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputArgument;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
class GenCommand extends ContainerAwareCommand
12
{
13
    protected function configure()
14
    {
15
        $this
16
            ->setName('supervisor:gen')
17
            ->addArgument('name', InputArgument::REQUIRED, 'Programm name')
18
            ->addArgument('cmd', InputArgument::IS_ARRAY, 'Symfony command')
19
            ->addOption('count', null, InputOption::VALUE_OPTIONAL, 'numproc')
20
            ->setDescription('run supervisor instance')
21
        ;
22
    }
23
24
    protected function execute(InputInterface $input, OutputInterface $output)
25
    {
26
        $supervisor = $this->getContainer()->get('ivan1986_supervisor.supervisor_service');
27
        $supervisor->genProgrammConf($input->getArgument('name'), array(
28
            'name' => $input->getArgument('name'),
29
            'command' => join(' ', $input->getArgument('cmd')),
30
            'numprocs' => $input->getOption('count')?:null,
31
        ));
32
    }
33
}
34