Passed
Push — develop ( 45600c...ff69f6 )
by Paul
03:16
created

Application::doRun()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
c 0
b 0
f 0
rs 9.2
cc 4
eloc 8
nc 2
nop 2
1
<?php
2
3
namespace PhpUnitGen\Console;
4
5
use Psr\Container\ContainerInterface;
6
use Symfony\Component\Console\Application as AbstractApplication;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Class Application.
12
 *
13
 * @author     Paul Thébaud <[email protected]>.
14
 * @copyright  2017-2018 Paul Thébaud <[email protected]>.
15
 * @license    https://opensource.org/licenses/MIT The MIT license.
16
 * @link       https://github.com/paul-thebaud/phpunit-generator
17
 * @since      Class available since Release 2.0.0.
18
 */
19
class Application extends AbstractApplication
20
{
21
    /**
22
     * Application constructor.
23
     *
24
     * @param ContainerInterface $container A container to manage dependencies.
25
     */
26
    public function __construct(ContainerInterface $container)
27
    {
28
        parent::__construct('phpunitgen', '2.0.0');
29
30
        $this->add(new GenerateTestsCommand($container));
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function doRun(InputInterface $input, OutputInterface $output)
37
    {
38
        if (! $output->isQuiet()) {
39
            $output->writeln(sprintf(
40
                "phpunitgen %s by Paul Thébaud.\n\n",
41
                $this->getVersion()
42
            ));
43
        }
44
45
        if ($input->hasParameterOption('--version') ||
46
            $input->hasParameterOption('-V')) {
47
            exit;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
48
        }
49
50
        parent::doRun($input, $output);
51
    }
52
}
53