| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class RoutingServiceProvider extends \Illuminate\Support\ServiceProvider |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Register the application services. |
||
| 12 | * |
||
| 13 | * @return void |
||
| 14 | */ |
||
| 15 | public function register() |
||
| 16 | { |
||
| 17 | $this->app->singleton(Router::class, function ($app) { |
||
| 18 | return new Router($app['events'], $app); |
||
| 19 | }); |
||
| 20 | $this->app->alias(Router::class, 'router'); |
||
| 21 | |||
| 22 | $this->app->singleton(UrlGenerator::class, function ($app) { |
||
| 23 | $routes = $app['router']->getRoutes(); |
||
| 24 | $app->instance('routes', $routes); |
||
| 25 | |||
| 26 | return new UrlGenerator( |
||
| 27 | $routes, |
||
| 28 | $app->rebinding('request', function ($app, $request) { |
||
| 29 | $app['url']->setRequest($request); |
||
| 30 | }), |
||
| 31 | $app['config']['app.asset_url'] |
||
|
|
|||
| 32 | ); |
||
| 33 | }); |
||
| 34 | $this->app->alias(UrlGenerator::class, 'url'); |
||
| 35 | |||
| 36 | $this->replaceUriValidator(); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Replace UriValidator |
||
| 41 | */ |
||
| 42 | protected function replaceUriValidator() |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
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. Please note the @ignore annotation hint above.