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

Application::getDefaultCommands()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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.1.1';
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
        return parent::doRun($input, $output);
49
    }
50
}
51