Authorize   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 2
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Dashboard\Http\Middleware;
4
5
use Illuminate\Support\Facades\Gate;
6
7
class Authorize
8
{
9
    /**
10
     * Authorize the current user.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @param  \Closure  $next
14
     * @return \Illuminate\Http\Response
15
     */
16
    public function handle($request, $next)
17
    {
18
        return Gate::check('viewWebSocketsDashboard', [$request->user()])
19
            ? $next($request)
20
            : abort(403);
0 ignored issues
show
Bug introduced by
Are you sure the usage of abort(403) is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
21
    }
22
}
23