Url   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A check() 0 26 5
1
<?php
2
3
namespace Spinzar\Firewall\Middleware;
4
5
use Spinzar\Firewall\Abstracts\Middleware;
6
use Spinzar\Firewall\Events\AttackDetected;
7
8
class Url extends Middleware
9
{
10
    public function check($patterns)
11
    {
12
        $protected = false;
13
14
        if (!$inspections = config('firewall.middleware.' . $this->middleware . '.inspections')) {
15
            return $protected;
16
        }
17
18
        foreach ($inspections as $inspection) {
19
            if (!$this->request->is($inspection)) {
20
                continue;
21
            }
22
23
            $protected = true;
24
25
            break;
26
        }
27
28
        if ($protected) {
29
            $log = $this->log();
30
31
            event(new AttackDetected($log));
32
        }
33
34
        return $protected;
35
    }
36
}
37