Reauthenticate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 2
A invalidated() 0 6 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()->put('url.intended', $request->url());
0 ignored issues
show
Bug introduced by
The method put() does not seem to exist on object<Symfony\Component...ssion\SessionInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
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
35
     *
36
     * @return \Illuminate\Http\RedirectResponse
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
        $url = config('app.reauthenticate_url', 'auth/reauthenticate');
41
42
        return redirect($url);
43
    }
44
}
45