ParaTestApplication   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 6
dl 0
loc 45
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A doRun() 0 6 1
A getDefinition() 0 6 1
A getCommandName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ParaTest\Console;
6
7
use ParaTest\Console\Commands\ParaTestCommand;
8
use ParaTest\Console\Testers\PHPUnit;
9
use Symfony\Component\Console\Application;
10
use Symfony\Component\Console\Input\InputDefinition;
11
use Symfony\Component\Console\Input\InputInterface;
12
use Symfony\Component\Console\Input\InputOption;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class ParaTestApplication extends Application
16
{
17
    const NAME = 'ParaTest';
18
    const VERSION = '1.0.1';
19
20
    public function __construct()
21
    {
22
        parent::__construct(static::NAME, VersionProvider::getVersion(static::VERSION));
23
    }
24
25
    /**
26
     * Instantiates the specific Tester and runs it via the ParaTestCommand.
27
     *
28
     * @todo for now paratest will only run the phpunit command
29
     */
30
    public function doRun(InputInterface $input, OutputInterface $output)
31
    {
32
        $this->add(new ParaTestCommand(new PHPUnit()));
33
34
        return parent::doRun($input, $output);
35
    }
36
37
    /**
38
     * The default InputDefinition for the application. Leave it to specific
39
     * Tester objects for specifying further definitions.
40
     *
41
     * @return InputDefinition
42
     */
43
    public function getDefinition(): InputDefinition
44
    {
45
        return new InputDefinition([
46
            new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
47
        ]);
48
    }
49
50
    /**
51
     * @param InputInterface $input
52
     *
53
     * @return string
54
     */
55
    public function getCommandName(InputInterface $input): string
56
    {
57
        return 'paratest';
58
    }
59
}
60