1 | <?php |
||
9 | class MakeEnum extends GeneratorCommand |
||
10 | { |
||
11 | protected $name = 'make:enum'; |
||
12 | protected $description = 'Create a new enum'; |
||
13 | |||
14 | public function handle() |
||
15 | 36 | { |
|
16 | $this->type = $this->getNameInput(); |
||
17 | 36 | ||
18 | return parent::handle(); |
||
19 | } |
||
20 | 36 | ||
21 | protected function getStub() |
||
22 | 36 | { |
|
23 | return __DIR__.'/../../stubs/enum.php.stub'; |
||
24 | } |
||
25 | 36 | ||
26 | protected function getDefaultNamespace($rootNamespace) |
||
27 | 36 | { |
|
28 | return $rootNamespace.'\Enums'; |
||
29 | 36 | } |
|
30 | 36 | ||
31 | protected function replaceClass($stub, $name) |
||
32 | 36 | { |
|
33 | $stub = parent::replaceClass($stub, $name); |
||
34 | |||
35 | 36 | $stub = str_replace('/** DummyDocBlock */', $this->getDocBlock(), $stub); |
|
36 | |||
37 | 36 | return $stub; |
|
38 | } |
||
39 | 36 | ||
40 | 32 | protected function getDocBlock(): string |
|
54 | 36 | ||
55 | 16 | protected function getArguments() |
|
56 | 16 | { |
|
57 | return [ |
||
58 | 16 | ['name', InputArgument::REQUIRED, 'The name of the enum'], |
|
61 | |||
62 | 16 | protected function getOptions() |
|
68 | } |
||
69 |