1 | <?php |
||
14 | class ArtisanServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | /** |
||
17 | * Indicates if loading of the provider is deferred. |
||
18 | * |
||
19 | * @var bool |
||
20 | */ |
||
21 | protected $defer = true; |
||
22 | |||
23 | /** |
||
24 | * The commands to be registered. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $commands = [ |
||
29 | 'CacheClear' => 'command.cache.clear', |
||
30 | 'CacheForget' => 'command.cache.forget', |
||
31 | 'ClearCompiled' => 'command.clear-compiled', |
||
32 | 'ClearResets' => 'command.auth.resets.clear', |
||
33 | 'ConfigCache' => 'command.config.cache', |
||
34 | 'ConfigClear' => 'command.config.clear', |
||
35 | 'Down' => 'command.down', |
||
36 | 'Environment' => 'command.environment', |
||
37 | 'KeyGenerate' => 'command.key.generate', |
||
38 | // 'Migrate' => 'command.migrate', |
||
39 | // 'MigrateInstall' => 'command.migrate.install', |
||
40 | // 'MigrateRefresh' => 'command.migrate.refresh', |
||
41 | // 'MigrateReset' => 'command.migrate.reset', |
||
42 | // 'MigrateRollback' => 'command.migrate.rollback', |
||
43 | // 'MigrateStatus' => 'command.migrate.status', |
||
44 | 'Optimize' => 'command.optimize', |
||
45 | 'QueueFailed' => 'command.queue.failed', |
||
46 | 'QueueFlush' => 'command.queue.flush', |
||
47 | 'QueueForget' => 'command.queue.forget', |
||
48 | 'QueueListen' => 'command.queue.listen', |
||
49 | 'QueueRestart' => 'command.queue.restart', |
||
50 | 'QueueRetry' => 'command.queue.retry', |
||
51 | 'QueueWork' => 'command.queue.work', |
||
52 | 'RouteCache' => 'command.route.cache', |
||
53 | 'RouteClear' => 'command.route.clear', |
||
54 | 'RouteList' => 'command.route.list', |
||
55 | // 'Seed' => 'command.seed', |
||
56 | 'ScheduleFinish' => ScheduleFinishCommand::class, |
||
57 | 'ScheduleRun' => ScheduleRunCommand::class, |
||
58 | 'StorageLink' => 'command.storage.link', |
||
59 | 'Up' => 'command.up', |
||
60 | 'ViewClear' => 'command.view.clear', |
||
61 | |||
62 | 'Route' => 'command+.route', |
||
63 | 'Tail' => 'command+.tail', |
||
64 | 'AddonList' => 'command+.addon.list', |
||
65 | 'AddonStatus' => 'command+.addon.status', |
||
66 | 'DatabaseStatus' => 'command+.database.status', |
||
67 | 'DatabaseUpgrade' => 'command+.database.upgrade', |
||
68 | 'DatabaseClean' => 'command+.database.clean', |
||
69 | 'DatabaseRefresh' => 'command+.database.refresh', |
||
70 | 'DatabaseRollback' => 'command+.database.rollback', |
||
71 | 'DatabaseAgain' => 'command+.database.again', |
||
72 | 'DatabaseSeed' => 'command+.database.seed', |
||
73 | 'HashMake' => 'command+.hash.make', |
||
74 | 'HashCheck' => 'command+.hash.check', |
||
75 | ]; |
||
76 | |||
77 | /** |
||
78 | * The commands to be registered. |
||
79 | * |
||
80 | * @var array |
||
81 | */ |
||
82 | protected $devCommands = [ |
||
83 | 'AppName' => 'command.app.name', |
||
84 | // 'AuthMake' => 'command.auth.make', |
||
85 | // 'CacheTable' => 'command.cache.table', |
||
86 | // 'ConsoleMake' => 'command.console.make', |
||
87 | // 'ControllerMake' => 'command.controller.make', |
||
88 | 'EventGenerate' => 'command.event.generate', |
||
89 | // 'EventMake' => 'command.event.make', |
||
90 | // 'JobMake' => 'command.job.make', |
||
91 | // 'ListenerMake' => 'command.listener.make', |
||
92 | // 'MailMake' => 'command.mail.make', |
||
93 | // 'MiddlewareMake' => 'command.middleware.make', |
||
94 | // 'MigrateMake' => 'command.migrate.make', |
||
95 | // 'ModelMake' => 'command.model.make', |
||
96 | // 'NotificationMake' => 'command.notification.make', |
||
97 | // 'NotificationTable' => 'command.notification.table', |
||
98 | // 'PolicyMake' => 'command.policy.make', |
||
99 | // 'ProviderMake' => 'command.provider.make', |
||
100 | // 'QueueFailedTable' => 'command.queue.failed-table', |
||
101 | // 'QueueTable' => 'command.queue.table', |
||
102 | // 'RequestMake' => 'command.request.make', |
||
103 | // 'SeederMake' => 'command.seeder.make', |
||
104 | // 'SessionTable' => 'command.session.table', |
||
105 | 'Serve' => 'command.serve', |
||
106 | // 'TestMake' => 'command.test.make', |
||
107 | 'VendorPublish' => 'command.vendor.publish', |
||
108 | |||
109 | 'AppContainer' => 'command+.app.container', |
||
110 | 'AddonName' => 'command+.addon.name', |
||
111 | 'AddonRemove' => 'command+.addon.remove', |
||
112 | |||
113 | 'MakeAddon' => 'command+.addon.make', |
||
114 | 'MakeCommand' => 'command+.command.make', |
||
115 | 'MakeController' => 'command+.controller.make', |
||
116 | 'MakeEvent' => 'command+.event.make', |
||
117 | 'MakeJob' => 'command+.job.make', |
||
118 | 'MakeListener' => 'command+.listener.make', |
||
119 | 'MakeMail' => 'command+.mail.make', |
||
120 | 'MakeMiddleware' => 'command+.middleware.make', |
||
121 | 'MakeMigration' => 'command+.migration.make', |
||
122 | 'MakeModel' => 'command+.model.make', |
||
123 | 'MakeNotification' => 'command+.notification.make', |
||
124 | 'MakePolicy' => 'command+.policy.make', |
||
125 | 'MakeProvider' => 'command+.provider.make', |
||
126 | 'MakeRequest' => 'command+.request.make', |
||
127 | 'MakeSeeder' => 'command+.seeder.make', |
||
128 | 'MakeTest' => 'command+.test.make', |
||
129 | ]; |
||
130 | |||
131 | /** |
||
132 | * Register the service provider. |
||
133 | * |
||
134 | * @return void |
||
135 | */ |
||
136 | 12 | public function register() |
|
140 | |||
141 | /** |
||
142 | * Get the services provided by the provider. |
||
143 | * |
||
144 | * @return array |
||
145 | */ |
||
146 | public function provides() |
||
150 | |||
151 | /** |
||
152 | * @return array |
||
153 | */ |
||
154 | 12 | protected function availableCommands() |
|
164 | |||
165 | /** |
||
166 | * Register the given commands. |
||
167 | * |
||
168 | * @param array $commands |
||
169 | * @return void |
||
170 | */ |
||
171 | 12 | protected function registerCommands(array $commands) |
|
179 | |||
180 | /** |
||
181 | * Register the command. |
||
182 | * |
||
183 | * @param string $command |
||
184 | * @return void |
||
185 | */ |
||
186 | 12 | protected function registerRouteCommand($command) |
|
192 | |||
193 | /** |
||
194 | * Register the command. |
||
195 | * |
||
196 | * @param string $command |
||
197 | * @return void |
||
198 | */ |
||
199 | 12 | protected function registerTailCommand($command) |
|
205 | |||
206 | /** |
||
207 | * Register the command. |
||
208 | * |
||
209 | * @param string $command |
||
210 | * @return void |
||
211 | */ |
||
212 | 12 | protected function registerAppContainerCommand($command) |
|
218 | |||
219 | /** |
||
220 | * Register the command. |
||
221 | * |
||
222 | * @param string $command |
||
223 | * @return void |
||
224 | */ |
||
225 | 12 | protected function registerAddonListCommand($command) |
|
231 | |||
232 | /** |
||
233 | * Register the command. |
||
234 | * |
||
235 | * @param string $command |
||
236 | * @return void |
||
237 | */ |
||
238 | 12 | protected function registerAddonStatusCommand($command) |
|
244 | |||
245 | /** |
||
246 | * Register the command. |
||
247 | * |
||
248 | * @param string $command |
||
249 | * @return void |
||
250 | */ |
||
251 | 12 | protected function registerAddonNameCommand($command) |
|
257 | |||
258 | /** |
||
259 | * Register the command. |
||
260 | * |
||
261 | * @param string $command |
||
262 | * @return void |
||
263 | */ |
||
264 | 12 | protected function registerAddonRemoveCommand($command) |
|
270 | |||
271 | /** |
||
272 | * Register the command. |
||
273 | * |
||
274 | * @param string $command |
||
275 | * @return void |
||
276 | */ |
||
277 | 12 | protected function registerDatabaseStatusCommand($command) |
|
283 | |||
284 | /** |
||
285 | * Register the command. |
||
286 | * |
||
287 | * @param string $command |
||
288 | * @return void |
||
289 | */ |
||
290 | 12 | protected function registerDatabaseUpgradeCommand($command) |
|
296 | |||
297 | /** |
||
298 | * Register the command. |
||
299 | * |
||
300 | * @param string $command |
||
301 | * @return void |
||
302 | */ |
||
303 | 12 | protected function registerDatabaseCleanCommand($command) |
|
309 | |||
310 | /** |
||
311 | * Register the command. |
||
312 | * |
||
313 | * @param string $command |
||
314 | * @return void |
||
315 | */ |
||
316 | 12 | protected function registerDatabaseRefreshCommand($command) |
|
322 | |||
323 | /** |
||
324 | * Register the command. |
||
325 | * |
||
326 | * @param string $command |
||
327 | * @return void |
||
328 | */ |
||
329 | 12 | protected function registerDatabaseRollbackCommand($command) |
|
335 | |||
336 | /** |
||
337 | * Register the command. |
||
338 | * |
||
339 | * @param string $command |
||
340 | * @return void |
||
341 | */ |
||
342 | 12 | protected function registerDatabaseAgainCommand($command) |
|
348 | |||
349 | /** |
||
350 | * Register the command. |
||
351 | * |
||
352 | * @param string $command |
||
353 | * @return void |
||
354 | */ |
||
355 | 12 | protected function registerDatabaseSeedCommand($command) |
|
361 | |||
362 | /** |
||
363 | * Register the command. |
||
364 | * |
||
365 | * @param string $command |
||
366 | * @return void |
||
367 | */ |
||
368 | 12 | protected function registerHashMakeCommand($command) |
|
374 | |||
375 | /** |
||
376 | * Register the command. |
||
377 | * |
||
378 | * @param string $command |
||
379 | * @return void |
||
380 | */ |
||
381 | 12 | protected function registerHashCheckCommand($command) |
|
387 | |||
388 | /** |
||
389 | * Register the command. |
||
390 | * |
||
391 | * @param string $command |
||
392 | * @return void |
||
393 | */ |
||
394 | 12 | protected function registerMakeAddonCommand($command) |
|
400 | |||
401 | /** |
||
402 | * Register the command. |
||
403 | * |
||
404 | * @param string $command |
||
405 | * @return void |
||
406 | */ |
||
407 | 12 | protected function registerMakeCommandCommand($command) |
|
413 | |||
414 | /** |
||
415 | * Register the command. |
||
416 | * |
||
417 | * @param string $command |
||
418 | * @return void |
||
419 | */ |
||
420 | 12 | protected function registerMakeControllerCommand($command) |
|
426 | |||
427 | /** |
||
428 | * Register the command. |
||
429 | * |
||
430 | * @param string $command |
||
431 | * @return void |
||
432 | */ |
||
433 | 12 | protected function registerMakeEventCommand($command) |
|
439 | |||
440 | /** |
||
441 | * Register the command. |
||
442 | * |
||
443 | * @param string $command |
||
444 | * @return void |
||
445 | */ |
||
446 | 12 | protected function registerMakeJobCommand($command) |
|
452 | |||
453 | /** |
||
454 | * Register the command. |
||
455 | * |
||
456 | * @param string $command |
||
457 | * @return void |
||
458 | */ |
||
459 | 12 | protected function registerMakeListenerCommand($command) |
|
465 | |||
466 | /** |
||
467 | * Register the command. |
||
468 | * |
||
469 | * @param string $command |
||
470 | * @return void |
||
471 | */ |
||
472 | 12 | protected function registerMakeMailCommand($command) |
|
478 | |||
479 | |||
480 | /** |
||
481 | * Register the command. |
||
482 | * |
||
483 | * @param string $command |
||
484 | * @return void |
||
485 | */ |
||
486 | 12 | protected function registerMakeMiddlewareCommand($command) |
|
492 | |||
493 | /** |
||
494 | * Register the command. |
||
495 | * |
||
496 | * @param string $command |
||
497 | * @return void |
||
498 | */ |
||
499 | 12 | protected function registerMakeMigrationCommand($command) |
|
505 | |||
506 | /** |
||
507 | * Register the command. |
||
508 | * |
||
509 | * @param string $command |
||
510 | * @return void |
||
511 | */ |
||
512 | 12 | protected function registerMakeModelCommand($command) |
|
518 | |||
519 | /** |
||
520 | * Register the command. |
||
521 | * |
||
522 | * @param string $command |
||
523 | * @return void |
||
524 | */ |
||
525 | 12 | protected function registerMakeNotificationCommand($command) |
|
531 | |||
532 | /** |
||
533 | * Register the command. |
||
534 | * |
||
535 | * @param string $command |
||
536 | * @return void |
||
537 | */ |
||
538 | 12 | protected function registerMakePolicyCommand($command) |
|
544 | |||
545 | /** |
||
546 | * Register the command. |
||
547 | * |
||
548 | * @param string $command |
||
549 | * @return void |
||
550 | */ |
||
551 | 12 | protected function registerMakeProviderCommand($command) |
|
557 | |||
558 | /** |
||
559 | * Register the command. |
||
560 | * |
||
561 | * @param string $command |
||
562 | * @return void |
||
563 | */ |
||
564 | 12 | protected function registerMakeRequestCommand($command) |
|
570 | |||
571 | /** |
||
572 | * Register the command. |
||
573 | * |
||
574 | * @param string $command |
||
575 | * @return void |
||
576 | */ |
||
577 | 12 | protected function registerMakeSeederCommand($command) |
|
583 | |||
584 | /** |
||
585 | * Register the command. |
||
586 | * |
||
587 | * @param string $command |
||
588 | * @return void |
||
589 | */ |
||
590 | protected function registerMakeTestCommand($command) |
||
596 | } |
||
597 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.