ValueObjectMakeCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 50
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultNamespace() 0 3 1
A getStub() 0 5 2
A getOptions() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MichaelRubel\ValueObjects\Artisan;
6
7
use Illuminate\Console\GeneratorCommand;
8
use Symfony\Component\Console\Input\InputOption;
9
10
class ValueObjectMakeCommand extends GeneratorCommand
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $name = 'make:value-object';
16
17
    /**
18
     * @var string
19
     */
20
    protected $description = 'Create a value object';
21
22
    /**
23
     * @var string
24
     */
25
    protected $type = 'Value Object';
26
27
    /**
28
     * Specify your Stub's location.
29
     *
30
     * @return string
31
     */
32 1
    protected function getStub(): string
33
    {
34 1
        return file_exists($customPath = $this->laravel->basePath('/stubs/value-object.stub'))
35
            ? $customPath // @codeCoverageIgnore
36 1
            : __DIR__ . '/stubs/value-object.stub';
37
    }
38
39
    /**
40
     * Get the default namespace for the class.
41
     *
42
     * @param  string  $rootNamespace
43
     *
44
     * @return string
45
     */
46 1
    protected function getDefaultNamespace($rootNamespace): string
47
    {
48 1
        return $rootNamespace . '\\ValueObjects';
49
    }
50
51
    /**
52
     * Get the console command options.
53
     *
54
     * @return array
55
     */
56 2
    protected function getOptions(): array
57
    {
58 2
        return [
59 2
            ['value-object', null, InputOption::VALUE_NONE, 'Create a value object'],
60 2
        ];
61
    }
62
}
63