Passed
Push — master ( 40ce26...965fb6 )
by Arthur
22:04
created

ServiceMakeCommand::afterGeneration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Foundation\Generator\Commands;
4
5
use Foundation\Generator\Abstracts\ClassGeneratorCommand;
6
use Foundation\Generator\Events\EventGeneratedEvent;
7
use Foundation\Generator\Events\ServiceGeneratedEvent;
8
use Foundation\Generator\Managers\GeneratorManager;
9
10
class ServiceMakeCommand extends ClassGeneratorCommand
11
{
12
    /**
13
     * The console command name.
14
     *
15
     * @var string
16
     */
17
    protected $name = 'larapi:make:service';
18
19
    /**
20
     * The console command description.
21
     *
22
     * @var string
23
     */
24
    protected $description = 'Create a new service class for the specified module';
25
26
    /**
27
     * The name of the generated resource.
28
     *
29
     * @var string
30
     */
31
    protected $generatorName = 'service';
32
33
    /**
34
     * The stub name.
35
     *
36
     * @var string
37
     */
38
    protected $stub = 'service.stub';
39
40
    /**
41
     * The file path.
42
     *
43
     * @var string
44
     */
45
    protected $filePath = '/Services';
46
47
    /**
48
     * The event that will fire when the file is created.
49
     *
50
     * @var string
51
     */
52
    protected $event = ServiceGeneratedEvent::class;
53
54
    protected function stubOptions(): array
55
    {
56
        return [
57
            'NAMESPACE' => $this->getClassNamespace(),
58
            'CLASS' => $this->getClassName(),
59
        ];
60
    }
61
62
    public function afterGeneration(): void
63
    {
64
        GeneratorManager::module($this->getModuleName(), $this->isOverwriteable())
65
            ->createServiceContract(ucfirst($this->getClassName()).'Contract');
66
    }
67
}
68