Passed
Push — master ( ecbb01...bd6415 )
by Albert
04:49 queued 02:14
created

LaravelServiceProvider::pushAccessLogMiddleware()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SwooleTW\Http;
4
5
use SwooleTW\Http\Server\Manager;
6
use Illuminate\Contracts\Http\Kernel;
7
use SwooleTW\Http\Middleware\AccessLog;
8
9
/**
10
 * @codeCoverageIgnore
11
 */
12
class LaravelServiceProvider extends HttpServiceProvider
13
{
14
    /**
15
     * Register manager.
16
     *
17
     * @return void
18
     */
19
    protected function registerManager()
20
    {
21
        $this->app->singleton(Manager::class, function ($app) {
22
            return new Manager($app, 'laravel');
23
        });
24
25
        $this->app->alias(Manager::class, 'swoole.manager');
26
    }
27
28
    /**
29
     * Boot websocket routes.
30
     *
31
     * @return void
32
     */
33
    protected function bootWebsocketRoutes()
34
    {
35
        require __DIR__ . '/../routes/laravel_routes.php';
36
    }
37
38
    /**
39
     * Register access log middleware to container.
40
     *
41
     * @return void
42
     */
43
    protected function pushAccessLogMiddleware()
44
    {
45
        $this->app->make(Kernel::class)->pushMiddleware(AccessLog::class);
0 ignored issues
show
Bug introduced by
The method pushMiddleware() does not exist on Illuminate\Contracts\Http\Kernel. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

45
        $this->app->make(Kernel::class)->/** @scrutinizer ignore-call */ pushMiddleware(AccessLog::class);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
    }
47
}
48