Passed
Push — dev ( 03a84b...1c649f )
by Chris
06:48 queued 10s
created

FinishManagerRegistration   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 18
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 9 4
1
<?php
2
namespace App\Http\Middleware;
3
4
use Closure;
5
6
class FinishManagerRegistration
7
{
8
    /**
9
     * If logged in, but manager registration is incomplete, redirect to finish it.
10
     *
11
     * @param  \Illuminate\Http\Request  $request
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
12
     * @param  \Closure  $next
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 17 spaces after parameter type; 2 found
Loading history...
13
     * @return mixed
14
     */
15
    public function handle($request, Closure $next)
1 ignored issue
show
Coding Style introduced by
Type hint "\Illuminate\Http\Request" missing for $request
Loading history...
16
    {
17
        $user = $request->user();
18
19
        if ($user !== null && $user->isManager() && !$user->isGovIdentityConfirmed()) {
20
            return redirect(route('manager.first_visit'));
21
        }
22
23
        return $next($request);
24
    }
25
}
26