Completed
Push — master ( 9919f9...1d1ba6 )
by Anton
09:31
created

RunCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 40
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 20 1
A execute() 0 8 1
1
<?php
2
/**
3
 * @copyright Bluz PHP Team
4
 * @link https://github.com/bluzphp/bluzman
5
 */
6
7
namespace Bluzman\Command;
8
9
use Application\CliBootstrap;
10
use Symfony\Component\Console\Input\InputArgument;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Output\OutputInterface;
13
14
/**
15
 * Class List command
16
 *
17
 * @package Bluzman\Command
18
 *
19
 * @author   Pavel Machekhin
20
 * @created  2013-03-28 14:03
21
 */
22
class RunCommand extends AbstractCommand
23
{
24
    /**
25
     * Command configuration
26
     */
27 14
    protected function configure()
28
    {
29
        $this
30
            // the name of the command (the part after "bin/bluzman")
31 14
            ->setName('run')
32
            // the short description shown while running "php bin/bluzman list"
33 14
            ->setDescription('Run controller')
34
            // the full command description shown when running the command with
35
            // the "--help" option
36 14
            ->setHelp('Run specified controller with options params')
37
        ;
38
39 14
        $params = new InputArgument(
40 14
            'uri',
41 14
            InputArgument::REQUIRED,
42 14
            'URI to call'
43
        );
44
45 14
        $this->getDefinition()->addArgument($params);
46 14
    }
47
48
    /**
49
     * @param InputInterface $input
50
     * @param OutputInterface $output
51
     * @return int|null|void
52
     */
53
    protected function execute(InputInterface $input, OutputInterface $output)
54
    {
55
        $app = CliBootstrap::getInstance();
56
        $app->setInput($input);
57
        $app->setOutput($output);
58
        $app->init($input->getOption('env'));
59
        $app->run();
60
    }
61
}
62