1 | <?php |
||
8 | abstract class RouteServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Bootstrap any application services. |
||
12 | * |
||
13 | * @param \Illuminate\Routing\Router $router |
||
|
|||
14 | * @return void |
||
15 | */ |
||
16 | public function boot() |
||
20 | |||
21 | /** |
||
22 | * Define the routes for the addon. |
||
23 | * |
||
24 | * @param \Illuminate\Routing\Router $router (injection) |
||
25 | * @return void |
||
26 | */ |
||
27 | public function map(Router $router) |
||
28 | { |
||
29 | $addon = $this->addon(); |
||
30 | $config = $addon->config('addon.routes'); |
||
31 | |||
32 | $attributes = [ |
||
33 | 'domain' => array_get($config, 'domain', null), |
||
34 | 'prefix' => array_get($config, 'prefix', ''), |
||
35 | 'namespace' => array_get($config, 'namespace', $addon->phpNamespace().'\\Controllers'), |
||
36 | 'middleware' => array_get($config, 'middleware', []), |
||
37 | ]; |
||
38 | |||
39 | $files = array_map(function ($file) use ($addon) { |
||
40 | return $addon->path($file); |
||
41 | }, array_get($config, 'files', ['classes/Http/routes.php'])); |
||
42 | |||
43 | $router->group($attributes, function ($router) use ($files) { |
||
44 | foreach ($files as $file) { |
||
45 | require $file; |
||
46 | } |
||
47 | }); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Get addon. |
||
52 | * |
||
53 | * @return \Jumilla\Addomnipot\Laravel\Addon |
||
54 | */ |
||
55 | abstract protected function addon(); |
||
56 | |||
57 | /** |
||
58 | * Register the service provider. |
||
59 | * |
||
60 | * @return void |
||
61 | */ |
||
62 | public function register() |
||
66 | |||
67 | /** |
||
68 | * Pass dynamic methods onto the router instance. |
||
69 | * |
||
70 | * @param string $method |
||
71 | * @param array $parameters |
||
72 | * @return mixed |
||
73 | */ |
||
74 | public function __call($method, $parameters) |
||
78 | } |
||
79 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.