Authorize   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 6 2
A allowedToUseTinker() 0 8 2
1
<?php
2
3
namespace Spatie\WebTinker\Http\Middleware;
4
5
use Illuminate\Support\Facades\Gate;
6
7
class Authorize
8
{
9
    public function handle($request, $next)
10
    {
11
        return $this->allowedToUseTinker()
12
            ? $next($request)
13
            : abort(403);
14
    }
15
16
    protected function allowedToUseTinker(): bool
17
    {
18
        if (! config('web-tinker.enabled')) {
19
            return false;
20
        }
21
22
        return Gate::check('viewWebTinker');
23
    }
24
}
25