Passed
Push — master ( 590453...ad5a85 )
by Arthur
24:49
created

RouteMakeCommand::getFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Foundation\Generator\Commands;
4
5
use Foundation\Generator\Abstracts\AbstractGeneratorCommand;
6
use Foundation\Generator\Abstracts\FileGeneratorCommand;
7
use Foundation\Generator\Events\RouteGeneratedEvent;
8
use Illuminate\Support\Str;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputOption;
11
12
class RouteMakeCommand extends FileGeneratorCommand
13
{
14
    /**
15
     * The console command name.
16
     *
17
     * @var string
18
     */
19
    protected $name = 'larapi:make:route';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Create a new route file for the specified module';
27
28
    /**
29
     * The name of the generated resource.
30
     *
31
     * @var string
32
     */
33
    protected $generatorName = 'route';
34
35
    /**
36
     * The stub name.
37
     *
38
     * @var string
39
     */
40
    protected $stub = 'route.stub';
41
42
    /**
43
     * The file path.
44
     *
45
     * @var string
46
     */
47
    protected $filePath = '/Routes';
48
49
    /**
50
     * The event that will fire when the file is created.
51
     *
52
     * @var string
53
     */
54
    protected $event = RouteGeneratedEvent::class;
55
56
    protected function stubOptions(): array
57
    {
58
        return [
59
            'MODULE_NAME' => ucfirst($this->getModuleName()),
60
            'CAPS_MODULE_NAME' => strtoupper($this->getModuleName()),
61
            'VERSION' => $this->getVersion()
62
        ];
63
    }
64
65
    protected function getVersion() :string {
66
        //TODO IMPLEMENT ASKING FOR VERSION
67
        return 'v1';
68
    }
69
70
    protected function afterGeneration(): void
71
    {
72
        $this->info("Don't forget to add permissions to the Permission model!");
73
    }
74
75
76
    protected function getFileName()
77
    {
78
        return strtolower(Str::plural($this->getModuleName())).'.'.$this->getVersion() . '.php';
79
    }
80
81
82
}
83