Completed
Pull Request — master (#44)
by Pádraic
02:00
created

Application::getCommandName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
20
    public function __construct()
21
    {
22
        parent::__construct(self::COMMAND_NAME, self::VERSION);
23
    }
24
25
    /**
26
     * @inheritdoc
27
     */
28
    public function doRun(InputInterface $input, OutputInterface $output)
29
    {
30
        if (false === $input->hasParameterOption('--quiet')) {
31
            $output->write(
32
                sprintf(
33
                    'phpmnd %s by Povilas Susinskas' . PHP_EOL,
34
                    $this->getVersion()
35
                )
36
            );
37
        }
38
39
        if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
40
            exit;
41
        }
42
43
        if ('run' === (string) $input) {
44
            $input = new ArrayInput(['run','--help']);
45
        }
46
47
        parent::doRun($input, $output);
48
    }
49
}
50