StepTimeLoggerController   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 2
A configure() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Bex\Behat\StepTimeLoggerExtension\Cli;
4
5
use Behat\Testwork\Cli\Controller;
6
use Bex\Behat\StepTimeLoggerExtension\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
final class StepTimeLoggerController 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('--log-step-times', null, InputOption::VALUE_NONE, 'Log step times');
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function execute(InputInterface $input, OutputInterface $output)
41
    {
42
        if ($input->getOption('log-step-times')) {
43
            $this->config->enableLogging();
44
        }
45
    }
46
}