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

getCommandUsingInteractiveForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4286
cc 1
eloc 4
nc 1
nop 2
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
}