1 | <?php |
||
13 | class ComponentMakeCommand extends GeneratorCommand |
||
14 | { |
||
15 | /** |
||
16 | * The console command name. |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $name = 'make:component'; |
||
21 | |||
22 | /** |
||
23 | * The console command description. |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $description = 'Create a new component class(ScoAdmin)'; |
||
28 | |||
29 | /** |
||
30 | * The type of class being generated. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $type = 'Component'; |
||
35 | |||
36 | protected $columnTypeMappings = [ |
||
37 | 'smallint' => 'text', |
||
38 | 'integer' => 'text', |
||
39 | 'bigint' => 'text', |
||
40 | 'float' => 'text', |
||
41 | 'string' => 'text', |
||
42 | 'text' => 'text', |
||
43 | 'boolean' => 'mapping', |
||
44 | 'datetime' => 'datetime', |
||
45 | 'date' => 'datetime', |
||
46 | ]; |
||
47 | |||
48 | protected $elementTypeMappings = [ |
||
49 | 'smallint' => 'number', |
||
50 | 'integer' => 'number', |
||
51 | 'bigint' => 'number', |
||
52 | 'float' => 'number', |
||
53 | 'string' => 'text', |
||
54 | 'text' => 'textarea', |
||
55 | 'boolean' => 'elswitch', |
||
56 | 'datetime' => 'datetime', |
||
57 | 'date' => 'date', |
||
58 | 'time' => 'time', |
||
59 | ]; |
||
60 | |||
61 | /** |
||
62 | * Execute the console command. |
||
63 | * |
||
64 | * @return void |
||
65 | */ |
||
66 | public function handle() |
||
76 | |||
77 | /** |
||
78 | * Create a new permission observer for the component |
||
79 | */ |
||
80 | protected function createObserver() |
||
90 | |||
91 | /** |
||
92 | * Get the fully-qualified class name. |
||
93 | * |
||
94 | * @param string $class |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | protected function parseClass($class) |
||
112 | |||
113 | /** |
||
114 | * Get the stub file for the generator. |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | protected function getStub() |
||
122 | |||
123 | /** |
||
124 | * Build the class with the given name. |
||
125 | * |
||
126 | * @param string $name |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | protected function buildClass($name) |
||
150 | |||
151 | protected function getViewColumns($model) |
||
164 | |||
165 | protected function buildViewColumn(Column $column) |
||
174 | |||
175 | protected function getColumnTitle(Column $column) |
||
179 | |||
180 | protected function getViewColumnType($name) |
||
184 | |||
185 | protected function getFormElements($model) |
||
197 | |||
198 | protected function buildFormElement(Column $column) |
||
207 | |||
208 | protected function getFormElementType($name) |
||
212 | |||
213 | protected function getTableColumns($class) |
||
233 | |||
234 | /** |
||
235 | * Get the default namespace for the class. |
||
236 | * |
||
237 | * @param string $rootNamespace |
||
238 | * |
||
239 | * @return string |
||
240 | */ |
||
241 | protected function getDefaultNamespace($rootNamespace) |
||
245 | |||
246 | /** |
||
247 | * Get the console command options. |
||
248 | * |
||
249 | * @return array |
||
250 | */ |
||
251 | protected function getOptions() |
||
268 | } |
||
269 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.