1 | <?php |
||||
2 | |||||
3 | namespace SwooleTW\Http; |
||||
4 | |||||
5 | use SwooleTW\Http\Server\Manager; |
||||
6 | use SwooleTW\Http\Middleware\AccessLog; |
||||
7 | |||||
8 | /** |
||||
9 | * @codeCoverageIgnore |
||||
10 | */ |
||||
11 | class LumenServiceProvider extends HttpServiceProvider |
||||
12 | { |
||||
13 | /** |
||||
14 | * Load configurations. |
||||
15 | */ |
||||
16 | protected function loadConfigs() |
||||
17 | { |
||||
18 | $this->app->configure('swoole_http'); |
||||
19 | $this->app->configure('swoole_websocket'); |
||||
20 | } |
||||
21 | |||||
22 | /** |
||||
23 | * Register manager. |
||||
24 | * |
||||
25 | * @return void |
||||
26 | */ |
||||
27 | protected function registerManager() |
||||
28 | { |
||||
29 | $this->app->singleton(Manager::class, function ($app) { |
||||
30 | return new Manager($app, 'lumen'); |
||||
31 | }); |
||||
32 | |||||
33 | $this->app->alias(Manager::class, 'swoole.manager'); |
||||
34 | } |
||||
35 | |||||
36 | /** |
||||
37 | * Boot websocket routes. |
||||
38 | * |
||||
39 | * @return void |
||||
40 | */ |
||||
41 | protected function bootWebsocketRoutes() |
||||
42 | { |
||||
43 | $this->app->router |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
44 | ->group(['namespace' => 'SwooleTW\Http\Controllers'], function ($router) { |
||||
45 | require __DIR__ . '/../routes/lumen_routes.php'; |
||||
46 | }); |
||||
47 | } |
||||
48 | |||||
49 | /** |
||||
50 | * Register access log middleware to container. |
||||
51 | * |
||||
52 | * @return void |
||||
53 | */ |
||||
54 | protected function pushAccessLogMiddleware() |
||||
55 | { |
||||
56 | $this->app->middleware(AccessLog::class); |
||||
0 ignored issues
–
show
SwooleTW\Http\Middleware\AccessLog::class of type string is incompatible with the type Closure|array expected by parameter $middleware of Laravel\Lumen\Application::middleware() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
57 | } |
||||
58 | } |
||||
59 |