1 | <?php |
||
16 | class SeedCommand extends Command |
||
17 | { |
||
18 | use ModuleCommandTrait; |
||
19 | |||
20 | /** |
||
21 | * The console command name. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $name = 'module:seed'; |
||
26 | |||
27 | /** |
||
28 | * The console command description. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $description = 'Run database seeder from the specified module or from all modules.'; |
||
33 | |||
34 | /** |
||
35 | * Execute the console command. |
||
36 | * @throws FatalThrowableError |
||
37 | */ |
||
38 | public function handle() |
||
57 | |||
58 | /** |
||
59 | * @throws RuntimeException |
||
60 | * |
||
61 | * @return Repository |
||
62 | */ |
||
63 | public function getModuleRepository() |
||
72 | |||
73 | /** |
||
74 | * @param $name |
||
75 | * |
||
76 | * @throws RuntimeException |
||
77 | * |
||
78 | * @return Module |
||
79 | */ |
||
80 | public function getModuleByName($name) |
||
89 | |||
90 | /** |
||
91 | * @param Module $module |
||
92 | * |
||
93 | * @return void |
||
94 | */ |
||
95 | public function moduleSeed(Module $module) |
||
118 | |||
119 | /** |
||
120 | * Seed the specified module. |
||
121 | * |
||
122 | * @param string $className |
||
123 | */ |
||
124 | protected function dbSeed($className) |
||
140 | |||
141 | /** |
||
142 | * Get master database seeder name for the specified module. |
||
143 | * |
||
144 | * @param string $name |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getSeederName($name) |
||
149 | { |
||
150 | $name = Str::studly($name); |
||
151 | |||
152 | $namespace = $this->laravel['modules']->config('namespace'); |
||
153 | $seederPath = GenerateConfigReader::read('seeder'); |
||
154 | $seederPath = str_replace('/', '\\', $seederPath->getPath()); |
||
155 | |||
156 | return $namespace . '\\' . $name . '\\' . $seederPath . '\\' . $name . 'DatabaseSeeder'; |
||
157 | } |
||
158 | |||
159 | /** |
||
160 | * Report the exception to the exception handler. |
||
161 | * |
||
162 | * @param \Symfony\Component\Console\Output\OutputInterface $output |
||
163 | * @param \Exception $e |
||
164 | * @return void |
||
165 | */ |
||
166 | protected function renderException($output, \Exception $e) |
||
170 | |||
171 | /** |
||
172 | * Report the exception to the exception handler. |
||
173 | * |
||
174 | * @param \Exception $e |
||
175 | * @return void |
||
176 | */ |
||
177 | protected function reportException(\Exception $e) |
||
181 | |||
182 | /** |
||
183 | * Get the console command arguments. |
||
184 | * |
||
185 | * @return array |
||
186 | */ |
||
187 | 91 | protected function getArguments() |
|
193 | |||
194 | /** |
||
195 | * Get the console command options. |
||
196 | * |
||
197 | * @return array |
||
198 | */ |
||
199 | 91 | protected function getOptions() |
|
206 | } |
||
207 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.