1 | <?php |
||
10 | class TerminalServiceProvider extends ServiceProvider |
||
11 | { |
||
12 | /** |
||
13 | * namespace. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $namespace = 'Recca0120\Terminal\Http\Controllers'; |
||
18 | |||
19 | /** |
||
20 | * Bootstrap any application services. |
||
21 | * |
||
22 | * @param \Illuminate\Http\Request $request |
||
23 | * @param \Illuminate\Routing\Router $router |
||
24 | */ |
||
25 | 1 | public function boot(Request $request, Router $router) |
|
37 | |||
38 | /** |
||
39 | * Register any application services. |
||
40 | */ |
||
41 | 1 | public function register() |
|
42 | { |
||
43 | 1 | $this->mergeConfigFrom(__DIR__.'/../config/terminal.php', 'terminal'); |
|
44 | |||
45 | $this->app->singleton(Application::class, function ($app) { |
||
46 | 1 | $config = $app['config']['terminal']; |
|
47 | 1 | $commands = $config['commands']; |
|
48 | 1 | $artisan = new Application($app, $app['events'], $app->version()); |
|
49 | 1 | $artisan->resolveCommands($commands, true); |
|
50 | |||
51 | 1 | return $artisan; |
|
52 | 1 | }); |
|
53 | |||
54 | $this->app->singleton(Kernel::class, function ($app) { |
||
55 | 1 | $config = $app['config']['terminal']; |
|
56 | |||
57 | 1 | return new Kernel($app[Application::class], array_merge($config, [ |
|
58 | 1 | 'basePath' => $app->basePath(), |
|
59 | 1 | 'environment' => $app->environment(), |
|
60 | 1 | 'version' => $app->version(), |
|
61 | 1 | 'endpoint' => $app['url']->route(Arr::get($config, 'route.as').'endpoint'), |
|
62 | 1 | ])); |
|
63 | 1 | }); |
|
64 | 1 | } |
|
65 | |||
66 | /** |
||
67 | * register routes. |
||
68 | * |
||
69 | * @param \Illuminate\Routing\Router $router |
||
70 | * @param array $config |
||
71 | */ |
||
72 | 1 | protected function handleRoutes(Router $router) |
|
73 | { |
||
74 | 1 | if ($this->app->routesAreCached() === false) { |
|
75 | 1 | $router->group([ |
|
76 | 1 | 'namespace' => $this->namespace, |
|
77 | 1 | 'prefix' => 'terminal', |
|
78 | 1 | 'as' => 'terminal.', |
|
79 | 1 | ], function (Router $router) { |
|
80 | require __DIR__.'/Http/routes.php'; |
||
81 | 1 | }); |
|
82 | 1 | } |
|
83 | 1 | } |
|
84 | |||
85 | /** |
||
86 | * handle publishes. |
||
87 | */ |
||
88 | 1 | protected function handlePublishes() |
|
102 | } |
||
103 |
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.