CliController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 2
b 0
f 0
dl 0
loc 24
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A __construct() 0 3 1
A execute() 0 6 1
1
<?php declare(strict_types=1);
2
namespace Behapi\Debug;
3
4
use Symfony\Component\Console\Command\Command;
5
use Symfony\Component\Console\Output\OutputInterface;
6
7
use Symfony\Component\Console\Input\InputOption;
8
use Symfony\Component\Console\Input\InputInterface;
9
10
use Behat\Testwork\Cli\Controller;
11
12
final class CliController implements Controller
13
{
14
    /** @var Status */
15
    private $status;
16
17
    public function __construct(Status $status)
18
    {
19
        $this->status = $status;
20
    }
21
22
    /** {@inheritDoc} */
23
    public function configure(Command $command)
24
    {
25
        $command
26
            ->addOption('behapi-debug', null, InputOption::VALUE_NONE, 'Activates the debug mode for behapi');
27
    }
28
29
    /** {@inheritDoc} */
30
    public function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        $debug = $input->getOption('behapi-debug');
33
        assert(is_bool($debug));
34
35
        $this->status->setEnabled($debug);
36
    }
37
}
38