1 | <?php |
||
9 | class CommandMaker extends GeneratorCommand |
||
10 | { |
||
11 | /** |
||
12 | * The console command name. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $name = 'make:command'; |
||
17 | |||
18 | /** |
||
19 | * The console command description. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $description = 'Create a new command'; |
||
24 | |||
25 | /** |
||
26 | * The type of class being generated. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $type = 'Console command'; |
||
31 | |||
32 | /** |
||
33 | * Replace the class name for the given stub. |
||
34 | * |
||
35 | * @param string $stub |
||
36 | * @param string $name |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | 1 | protected function replaceClass($stub, $name) |
|
41 | { |
||
42 | 1 | $stub = parent::replaceClass($stub, $name); |
|
43 | |||
44 | 1 | return str_replace('dummy:command', $this->option('command'), $stub); |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Get the desired class name from the input. |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | 1 | protected function getNameInput() |
|
53 | { |
||
54 | 1 | return ucfirst(parent::getNameInput()); |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * Get the stub file for the generator. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | 1 | protected function getStub() |
|
63 | { |
||
64 | 1 | return __DIR__.'/stubs/console.stub'; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Get the default namespace for the class. |
||
69 | * |
||
70 | * @param string $rootNamespace |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | 1 | protected function getDefaultNamespace($rootNamespace) |
|
75 | { |
||
76 | 1 | return $rootNamespace.'\Commands'; |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * Get the console command arguments. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | 47 | protected function getArguments() |
|
90 | |||
91 | /** |
||
92 | * Get the console command options. |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | 47 | protected function getOptions() |
|
108 | } |
||
109 |