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

Application   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A registerCommands() 0 3 1
A run() 0 9 2
A doRun() 0 4 1
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