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

FinishHrRegistration::handle()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 1
b 0
f 0
cc 4
nc 2
nop 2
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