Total Complexity | 7 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | abstract class ClassGeneratorCommand extends AbstractGeneratorCommand |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Get the console command arguments. |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | protected function setArguments() :array |
||
31 | ]; |
||
32 | } |
||
33 | |||
34 | protected function handleNameArgument() |
||
35 | { |
||
36 | return $this->ask('Specify the name of the ' . $this->getGeneratorName() . '.'); |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return string |
||
41 | */ |
||
42 | protected function getFileName() :string |
||
43 | { |
||
44 | return $this->getClassName() . '.php'; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Get class namespace. |
||
49 | * |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getClassNamespace(): string |
||
56 | } |
||
57 | |||
58 | protected function getClassName(){ |
||
59 | $className = $this->getArgument('name'); |
||
60 | if($className===null){ |
||
61 | $this->error('class name not specified'); |
||
62 | throw new \Exception('Name of ' . $this->getGeneratorName() . ' not set.'); |
||
63 | } |
||
64 | return $className; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Get the console command options. |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | protected function setOptions() :array |
||
75 | } |
||
76 | } |
||
77 |