ModuleMakerCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
ccs 5
cts 5
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: 24/11/2018
6
 * Time: 22:07
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 ModuleMakerCommand extends Command
19
{
20
21
22 2
    protected function configure()
23
    {
24 2
        $this->setName("create:module")
25 2
            ->setDescription("Cria um modulo e suas pastas iniciais")
26 2
            ->addArgument("modulo", InputArgument::REQUIRED, "Nome do modulo")
27 2
            ->addArgument("diretorio", InputArgument::REQUIRED, "Local onde será criado o modulo");
28 2
    }
29
30
    /**
31
     * @param InputInterface $input
32
     * @param OutputInterface $output
33
     * @return int|null|void
34
     */
35 1
    protected function execute(InputInterface $input, OutputInterface $output)
36
    {
37 1
        $modulo = $input->getArgument("modulo");
38 1
        $diretorio = $input->getArgument("diretorio");
39
40 1
        $module = Module::create($modulo, $diretorio);
0 ignored issues
show
Bug introduced by
It seems like $diretorio can also be of type null and string[]; however, parameter $diretorio of Saci\Console\Domain\Entity\Module::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

40
        $module = Module::create($modulo, /** @scrutinizer ignore-type */ $diretorio);
Loading history...
Bug introduced by
It seems like $modulo can also be of type null and string[]; however, parameter $name of Saci\Console\Domain\Entity\Module::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

40
        $module = Module::create(/** @scrutinizer ignore-type */ $modulo, $diretorio);
Loading history...
41
42 1
        $output->writeln("Modulo {$module->getName()} foi criado");
43
    }
44
}