VerifyEmailController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 11 3
1
<?php
2
3
namespace App\Http\Controllers\Auth;
4
5
use App\Http\Controllers\Controller;
6
use Illuminate\Auth\Events\Verified;
7
use Illuminate\Foundation\Auth\EmailVerificationRequest;
8
use Illuminate\Http\RedirectResponse;
9
10
class VerifyEmailController extends Controller
11
{
12
    /**
13
     * Mark the authenticated user's email address as verified.
14
     */
15
    public function __invoke(EmailVerificationRequest $request): RedirectResponse
16
    {
17
        if ($request->user()->hasVerifiedEmail()) {
0 ignored issues
show
Bug introduced by
The method user() does not exist on Illuminate\Foundation\Au...mailVerificationRequest. ( Ignorable by Annotation )

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

17
        if ($request->/** @scrutinizer ignore-call */ user()->hasVerifiedEmail()) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
18
            return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
19
        }
20
21
        if ($request->user()->markEmailAsVerified()) {
22
            event(new Verified($request->user()));
23
        }
24
25
        return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
26
    }
27
}
28