Test Failed
Push — master ( 4e8d3d...451ac1 )
by Antonio Carlos
03:57 queued 48s
created

BlockAttacks::handle()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 2
nop 2
crap 3
1
<?php
2
3
namespace PragmaRX\Firewall\Middleware;
4
5
use Closure;
6
7
class BlockAttacks extends Middleware
8
{
9
    /**
10
     * Block attacks.
11
     *
12
     * @param \Illuminate\Http\Request $request
13
     * @param \Closure                 $next
14
     *
15
     * @return mixed
16
     */
17 1
    public function handle($request, Closure $next)
18
    {
19 1
        if ($this->enabled() && app('firewall')->isBeingAttacked()) {
20 1
            return app('firewall')->responseToAttack();
21
        }
22
23 1
        return $next($request);
24
    }
25
}
26