Completed
Push — master ( 0ae072...5bde57 )
by Anton
04:24 queued 01:11
created

Authenticate::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of Laravel Sense.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Laravel\Sense\Http\Middleware;
15
16
use Cog\Laravel\Sense\Authentication\Services\Authenticator;
17
18
class Authenticate
19
{
20
    /**
21
     * Handle the incoming request.
22
     *
23
     * @param  \Illuminate\Http\Request $request
24
     * @param  \Closure $next
25
     * @return \Illuminate\Http\Response|null
26
     */
27
    public function handle($request, $next)
28
    {
29
        return Authenticator::check($request) ? $next($request) : 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...
30
    }
31
}
32