CheckAccessToMonitoringPanel::handle()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 5
c 1
b 0
f 0
nc 4
nop 2
dl 0
loc 11
rs 10
1
<?php
2
3
namespace MohsenAbrishami\Stethoscope\Http\Middleware;
4
5
use Closure;
6
7
class CheckAccessToMonitoringPanel
8
{
9
    public function handle($request, Closure $next)
10
    {
11
        if (! config('stethoscope.monitoring_panel.status')) {
12
            abort(404);
13
        }
14
15
        if (config('stethoscope.monitoring_panel.key') && request()->get('key') != config('stethoscope.monitoring_panel.key')) {
16
            abort(404);
17
        }
18
19
        return $next($request);
20
    }
21
}
22