VerifyGdaemonCreateToken   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 2
1
<?php
2
3
namespace Gameap\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Support\Facades\Cache;
7
use Symfony\Component\HttpKernel\Exception\HttpException;
8
9
class VerifyGdaemonCreateToken
10
{
11
    public function handle($request, Closure $next)
12
    {
13
        $autoCreateToken = Cache::get('gdaemonAutoCreateToken');
14
15
        if ($request->route('token') != $autoCreateToken) {
16
            throw new HttpException(401, 'Invalid token');
17
        }
18
19
        return $next($request);
20
    }
21
}
22