Total Complexity | 5 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class AuthenticateWithMagicLink |
||
12 | { |
||
13 | /** |
||
14 | * Handle an incoming request. |
||
15 | * |
||
16 | * @param \Illuminate\Http\Request $request |
||
17 | * @param \Closure $next |
||
18 | * @param string|null $guard |
||
19 | * @return mixed |
||
20 | */ |
||
21 | public function handle( |
||
22 | $request, |
||
23 | Closure $next, |
||
24 | $guard = null |
||
25 | ) { |
||
26 | if (!Auth::guard($guard)->check()) { |
||
27 | throw new AuthenticationException; |
||
28 | } |
||
29 | |||
30 | if (!Auth::guard($guard)->user()->viaMagicLink()) { |
||
31 | $response = $this->sendMagicLinkEmail($request); |
||
32 | |||
33 | Auth::guard($guard)->logout(); |
||
34 | |||
35 | return redirect() |
||
36 | ->guest(route('login')) |
||
37 | ->with('status', __($response)); |
||
38 | } |
||
39 | |||
40 | return $next($request); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Send a magic link to the given user. |
||
45 | * |
||
46 | * @param \Illuminate\Http\Request $request |
||
47 | * @return string |
||
48 | */ |
||
49 | private function sendMagicLinkEmail(Request $request) |
||
54 | ] |
||
55 | ); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Get the broker to be used during magic authentication. |
||
60 | * |
||
61 | * @return \Soved\Laravel\Magic\Auth\Links\LinkBroker |
||
62 | */ |
||
63 | private function broker() |
||
68 | } |
||
69 | } |
||
70 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths