RedirectIfAuthenticated   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 35
ccs 0
cts 11
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 8 2
1
<?php
2
3
namespace plunner\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Contracts\Auth\Guard;
7
8
class RedirectIfAuthenticated
9
{
10
    /**
11
     * The Guard implementation.
12
     *
13
     * @var Guard
14
     */
15
    protected $auth;
16
17
    /**
18
     * Create a new filter instance.
19
     *
20
     * @param  Guard $auth
21
     */
22
    public function __construct(Guard $auth)
23
    {
24
        $this->auth = $auth;
25
    }
26
27
    /**
28
     * Handle an incoming request.
29
     *
30
     * @param  \Illuminate\Http\Request $request
31
     * @param  \Closure $next
32
     * @return mixed
33
     */
34
    public function handle($request, Closure $next)
35
    {
36
        if ($this->auth->check()) {
37
            return redirect('/');
38
        }
39
40
        return $next($request);
41
    }
42
}
43