Passed
Push — dependabot/npm_and_yarn/dev/st... ( 790070...2dbd00 )
by
unknown
17:44 queued 12:22
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
12
     * @param  \Closure  $next
13
     * @return mixed
14
     */
15
    public function handle($request, Closure $next)
16
    {
17
        $user = $request->user();
18
19
        if ($user !== null && $user->isHrAdvisor() && !$user->isGovIdentityConfirmed()) {
20
            return redirect(route('hr_advisor.first_visit'));
0 ignored issues
show
Bug introduced by
The function route was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
            return redirect(/** @scrutinizer ignore-call */ route('hr_advisor.first_visit'));
Loading history...
Bug introduced by
The function redirect was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
            return /** @scrutinizer ignore-call */ redirect(route('hr_advisor.first_visit'));
Loading history...
21
        }
22
23
        return $next($request);
24
    }
25
}
26