Passed
Push — master ( fa3bf1...2fa9b0 )
by
unknown
04:14
created

CommandHandlerMakerCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: thales
5
 * Date: 14/01/2019
6
 * Time: 19:10
7
 */
8
9
namespace Saci\Console\Application\Commands;
10
11
12
use Saci\Console\Domain\Entity\Module;
13
use Symfony\Component\Console\Command\Command;
14
use Symfony\Component\Console\Input\InputArgument;
15
use Symfony\Component\Console\Input\InputInterface;
16
use Symfony\Component\Console\Output\OutputInterface;
17
18
class CommandHandlerMakerCommand extends Command
19
{
20
    protected function configure()
21
    {
22
        $this->setName("create:module")
23
            ->setDescription("Cria as classe de Command e CommandHandler")
24
            ->addArgument("nome", InputArgument::REQUIRED, "Nome do Command Handler")
25
            ->addArgument("diretorio", InputArgument::REQUIRED, "Local onde será criado o Command handler")
26
            ->addArgument("nomeModule", InputArgument::REQUIRED, "Nome do módulo");
27
    }
28
29
    /**
30
     * @param InputInterface $input
31
     * @param OutputInterface $output
32
     * @return int|null|void
33
     */
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $nome = $input->getArgument("nome");
37
        $diretorio = $input->getArgument("diretorio");
38
        $moduleName = $input->getArgument("nomeModule");
39
40
        $module = new Module($moduleName, $diretorio);
0 ignored issues
show
Bug introduced by
It seems like $moduleName can also be of type null and string[]; however, parameter $name of Saci\Console\Domain\Entity\Module::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        $module = new Module(/** @scrutinizer ignore-type */ $moduleName, $diretorio);
Loading history...
Bug introduced by
It seems like $diretorio can also be of type null and string[]; however, parameter $diretorio of Saci\Console\Domain\Entity\Module::__construct() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        $module = new Module($moduleName, /** @scrutinizer ignore-type */ $diretorio);
Loading history...
41
        \Saci\Console\Domain\Entity\Command::create($nome, $module);
0 ignored issues
show
Bug introduced by
It seems like $nome can also be of type null and string[]; however, parameter $name of Saci\Console\Domain\Entity\Command::create() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
        \Saci\Console\Domain\Entity\Command::create(/** @scrutinizer ignore-type */ $nome, $module);
Loading history...
42
43
        $output->writeln("Command Handler {$nome} foi criado");
44
    }
45
}