CommandHandlerMakerCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
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 2
    protected function configure()
21
    {
22 2
        $this->setName("create:command")
23 2
            ->setDescription("Cria as classe de Command e CommandHandler")
24 2
            ->addArgument("nome", InputArgument::REQUIRED, "Nome do Command Handler")
25 2
            ->addArgument("diretorio", InputArgument::REQUIRED, "Local onde será criado o Command handler")
26 2
            ->addArgument("nomeModule", InputArgument::REQUIRED, "Nome do módulo");
27 2
    }
28
29
    /**
30
     * @param InputInterface $input
31
     * @param OutputInterface $output
32
     * @return int|null|void
33
     */
34 1
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36 1
        $nome = $input->getArgument("nome");
37 1
        $diretorio = $input->getArgument("diretorio");
38 1
        $moduleName = $input->getArgument("nomeModule");
39
40 1
        $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 1
        \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 1
        $output->writeln("Command Handler {$nome} foi criado");
44
    }
45
}