Completed
Push — master ( b5231e...2792e5 )
by Christian
02:36
created

Application::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace uuf6429\ElderBrother\Console;
4
5
use Symfony\Component\Console\Application as ConsoleApplication;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Logger\ConsoleLogger;
8
use Symfony\Component\Console\Output\ConsoleOutput;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use uuf6429\ElderBrother\Config;
11
12
class Application extends ConsoleApplication
13
{
14
    /**
15
     * @var ConsoleOutput
16
     */
17
    private $output;
18
    /**
19
     * @var ConsoleLogger
20
     */
21
    private $logger;
22
    /**
23
     * @var Config
24
     */
25
    private $config;
26
27
    public function __construct()
28
    {
29
        error_reporting(-1);
30
31
        parent::__construct('Elder Brother', '1.0.0');
32
33
        $this->output = new ConsoleOutput();
34
        $this->logger = new ConsoleLogger($this->output);
35
        $this->config = new Config(
36
            [
37
                'project config' => 'path1', // TODO fix path
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
38
                'user config' => 'path1', // TODO fix path
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
39
            ],
40
            $this->logger
41
        );
42
43
        $this->add(new Command\Run($this->config));
44
        //$this->add(new Command\GitInstall());
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
45
        //$this->add(new Command\GitUninstall());
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     *
51
     * @throws \RuntimeException
52
     */
53
    public function run(InputInterface $input = null, OutputInterface $output = null)
54
    {
55
        if ($output) {
56
            throw new \RuntimeException('Output cannot be set.');
57
        }
58
59
        return parent::run($input, $this->output);
60
    }
61
}
62