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

Application   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
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 36
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.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