Passed
Push — master ( 146e66...93ff04 )
by Nils
02:21
created

Application::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Leankoala\HealthFoundation\Cli;
4
5
use Leankoala\HealthFoundation\Cli\Command\RunCommand;
6
use Symfony\Component\Console\Formatter\OutputFormatter;
7
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\ConsoleOutput;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class Application extends \Symfony\Component\Console\Application
13
{
14
    public function run(InputInterface $input = null, OutputInterface $output = null)
15
    {
16
        if (null === $output) {
17
            $styles = array();
18
            $styles['failure'] = new OutputFormatterStyle('red');
19
            $formatter = new OutputFormatter(false, $styles);
20
            $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
21
        }
22
        return parent::run($input, $output);
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function doRun(InputInterface $input, OutputInterface $output)
29
    {
30
        $this->registerCommands();
31
        return parent::doRun($input, $output);
32
    }
33
34
    /**
35
     * Initializes all the commands.
36
     */
37
    private function registerCommands()
38
    {
39
        $this->add(new RunCommand());
40
    }
41
}
42