FailingCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest\Controller\Mock;
6
7
use RuntimeException;
8
use Symfony\Component\Console\Command\Command;
9
use Symfony\Component\Console\Input\InputInterface;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class FailingCommand extends Command
13
{
14
    protected function configure() : void
15
    {
16
        $this->setName('fail')
17
            ->addOption('exception', null, null, 'fail with an exception');
18
    }
19
20
    protected function execute(InputInterface $input, OutputInterface $output) : int
21
    {
22
        if ($input->getOption('exception')) {
23
            throw new RuntimeException();
24
        }
25
26
        return 1;
27
    }
28
}
29