Passed
Push — 0.5 ( 992a0c...ce220b )
by Ben
07:09
created

MonitorMiddleware   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Thinktomorrow\Chief\System\HealthMonitor\Middleware;
6
7
use Closure;
8
use Thinktomorrow\Chief\System\HealthMonitor\Monitor;
9
10
class MonitorMiddleware
11
{
12
    /**
13
     * Handle an incoming request.
14
     *
15
     * @param \Illuminate\Http\Request $request
16
     * @param \Closure $next
17
     * @return mixed
18
     */
19
    public function handle($request, Closure $next)
20
    {
21
        if ($request->isMethod('get')) {
22
            app(Monitor::class)->check();
23
        }
24
25
        return $next($request);
26
    }
27
}
28