Completed
Push — master ( 4c2c69...98de2e )
by Marcel
03:44 queued 58s
created

Reauthenticate   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 6
Bugs 2 Features 0
Metric Value
wmc 3
c 6
b 2
f 0
lcom 0
cbo 3
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 2
A invalidated() 0 4 1
1
<?php
2
3
namespace Mpociot\Reauthenticate\Middleware;
4
5
use Closure;
6
use Mpociot\Reauthenticate\ReauthLimiter;
7
8
class Reauthenticate
9
{
10
    /**
11
     * Handle an incoming request.
12
     *
13
     * @param \Illuminate\Http\Request $request
14
     * @param \Closure                 $next
15
     *
16
     * @return mixed
17
     */
18
    public function handle($request, Closure $next)
19
    {
20
        $reauth = new ReauthLimiter($request);
21
22
        if (!$reauth->check()) {
23
            $request->session()->set('url.intended', $request->url());
24
25
            return $this->invalidated($request);
26
        }
27
28
        return $next($request);
29
    }
30
31
    /**
32
     * Handle invalidated auth.
33
     *
34
     * @param \Illuminate\Http\Request $request
35
     *
36
     * @return mixed
37
     */
38
    protected function invalidated($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        return redirect('auth/reauthenticate');
41
    }
42
}
43