Passed
Push — task/comments-api ( c7d753...19d8e5 )
by Yonathan
32:15 queued 19:33
created

FinishHrRegistration   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
dl 0
loc 18
rs 10
c 1
b 0
f 0

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 FinishHrRegistration
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->isHrAdvisor() && !$user->isGovIdentityConfirmed()) {
20
            return redirect(route('hr_advisor.first_visit'));
21
        }
22
23
        return $next($request);
24
    }
25
}
26