ScenarioChooserController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Bex\Behat\ChooseTestsExtension\Controller;
4
5
use Behat\Testwork\Cli\Controller;
6
use Bex\Behat\ChooseTestsExtension\ServiceContainer\Config;
7
use Symfony\Component\Console\Command\Command as SymfonyCommand;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class ScenarioChooserController implements Controller
13
{
14
    /**
15
     * @var Config
16
     */
17
    private $config;
18
    
19
    /**
20
     * @param Config $config
21
     */
22
    public function __construct(Config $config)
23
    {
24
        $this->config = $config;
25
    }
26
27
    /**
28
     * Configures command to be executable by the controller.
29
     *
30
     * @param SymfonyCommand $command
31
     */
32
    public function configure(SymfonyCommand $command)
33
    {
34
        $command->addOption('--choose-scenario', null, InputOption::VALUE_NONE, 'Choose scenario');
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        if ($input->getOption('choose-scenario') && $input->isInteractive()) {
43
            $this->config->enableScenarioSelector();
44
        }
45
    }
46
}
47