1 | <?php |
||
2 | |||
3 | namespace Scuttlebyte\ContextManager\Laravel; |
||
4 | |||
5 | use http\Env\Request; |
||
6 | use Scuttlebyte\ContextManager\ContextManager; |
||
7 | |||
8 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * Register bindings in the container. |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | public function register() |
||
16 | { |
||
17 | $this->app->singleton(ContextManager::class, function ($app) { |
||
0 ignored issues
–
show
|
|||
18 | return new ContextManager(); |
||
19 | }); |
||
20 | } |
||
21 | |||
22 | public function provides() { |
||
23 | return [ContextManager::class]; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Boot methods for the package |
||
28 | */ |
||
29 | public function boot() |
||
30 | { |
||
31 | // Laravel takes over `$this` context over in the macro closure, |
||
32 | // so we have to bind $this->app to a variable here instead. |
||
33 | $app = $this->app; |
||
34 | |||
35 | $this->app['request']->macro('context', function () use ($app) { |
||
36 | return $app[ContextManager::class]; |
||
37 | }); |
||
38 | } |
||
39 | } |
||
40 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.