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

Application   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B doRun() 0 21 5
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