Command::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 16
ccs 9
cts 9
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: thales
5
 * Date: 17/01/2019
6
 * Time: 19:47
7
 */
8
9
namespace Saci\Console\Infrastructure\Domain\Services\PhpClass;
10
11
12
use cristianoc72\codegen\model\GenerateableInterface;
13
use cristianoc72\codegen\model\PhpMethod;
14
use Saci\Console\Domain\Services\Exception\ClassNameIsNullException;
15
use Saci\Console\Domain\Services\PhpClass as PhpClassInterface;
16
17
class Command extends AbstractPhpClass implements PhpClassInterface
18
{
19
20 4
    public function make(): GenerateableInterface
21
    {
22 4
        $moduleName = $this->getModuleName();
23 4
        $className = $this->getClassName();
24
25 4
        if (!$className) {
26 1
            throw new ClassNameIsNullException('Não foi informado a nome para a Command. Utilize o método setClassName para innforma o nome da classe!');
27
        }
28
29
        $this
30 3
            ->setQualifiedName("Saci\\{$moduleName}\\UseCase\\{$className}")
31 3
            ->setMethod(
32 3
                PhpMethod::create('__construct')
33
            );
34
35 3
        return $this;
36
    }
37
}