Completed
Pull Request — master (#44)
by Pádraic
01:58
created

Application::doRun()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 21
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 8.7624
cc 5
eloc 11
nc 6
nop 2
1
<?php
2
3
namespace Povils\PHPMND\Console;
4
5
use Symfony\Component\Console\Application as BaseApplication;
6
use Symfony\Component\Console\Input\ArrayInput;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Class Application
12
 *
13
 * @package Povils\PHPMND\Console
14
 */
15
class Application extends BaseApplication
16
{
17
    const VERSION = '1.0.3';
18
    const COMMAND_NAME = 'phpmnd';
19
    const PACKAGIST_PACKAGE_NAME = 'povils/phpmnd';
20
21
    public function __construct()
22
    {
23
        parent::__construct(self::COMMAND_NAME, self::VERSION);
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function doRun(InputInterface $input, OutputInterface $output)
30
    {
31
        if (false === $input->hasParameterOption('--quiet')) {
32
            $output->write(
33
                sprintf(
34
                    'phpmnd %s by Povilas Susinskas' . PHP_EOL,
35
                    $this->getVersion()
36
                )
37
            );
38
        }
39
40
        if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
41
            exit;
42
        }
43
44
        if ('run' === (string) $input) {
45
            $input = new ArrayInput(['run','--help']);
46
        }
47
48
        parent::doRun($input, $output);
49
    }
50
}
51