FailingCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 17
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 8 2
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