Completed
Pull Request — master (#11)
by
unknown
05:47
created

BaseInteractiveCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 20
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCommandUsingInteractiveForm() 0 8 1
1
<?php
2
3
namespace Clearcode\CommandBusConsole\Bundle;
4
5
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use tests\Clearcode\CommandBusConsole\Bundle\Type\DummyCommandType;
9
10
class BaseInteractiveCommand extends ContainerAwareCommand
11
{
12
    private static $commandToFormTypeMap = [
0 ignored issues
show
Unused Code introduced by
The property $commandToFormTypeMap is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
13
        'DummyCommand' => DummyCommandType::class,
14
    ];
15
16
    /**
17
     * @param InputInterface $input
18
     * @param OutputInterface $output
19
     * @return mixed
20
     */
21
    protected function getCommandUsingInteractiveForm(InputInterface $input, OutputInterface $output)
22
    {
23
        /** @var FormHelper $formHelper */
24
        $formHelper = $this->getHelper('form');
25
26
        $commandName = $input->getArgument('commandName');
27
        return $formHelper->interactUsingForm(new self::$commandToFormTypeMap[$commandName](), $input, $output);
28
    }
29
}