MustVerifyEmail   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
c 1
b 0
f 0
dl 0
loc 43
ccs 0
cts 12
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A markEmailAsVerified() 0 5 1
A hasVerifiedEmail() 0 3 1
A getEmailForVerification() 0 3 1
A sendEmailVerificationNotification() 0 4 1
1
<?php
2
3
namespace MedianetDev\LaravelAuthApi\Http\Controllers\Traits;
4
5
trait MustVerifyEmail
6
{
7
    /**
8
     * Determine if the user has verified their email address.
9
     *
10
     * @return bool
11
     */
12
    public function hasVerifiedEmail()
13
    {
14
        return ! is_null($this->email_verified_at);
15
    }
16
17
    /**
18
     * Mark the given user's email as verified.
19
     *
20
     * @return bool
21
     */
22
    public function markEmailAsVerified()
23
    {
24
        return $this->forceFill([
0 ignored issues
show
Bug introduced by
It seems like forceFill() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

24
        return $this->/** @scrutinizer ignore-call */ forceFill([
Loading history...
25
            'email_verified_at' => $this->freshTimestamp(),
0 ignored issues
show
Bug introduced by
It seems like freshTimestamp() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

25
            'email_verified_at' => $this->/** @scrutinizer ignore-call */ freshTimestamp(),
Loading history...
26
        ])->save();
27
    }
28
29
    /**
30
     * Send the email verification notification.
31
     *
32
     * @return void
33
     */
34
    public function sendEmailVerificationNotification()
35
    {
36
        $emailTemplate = config('laravel-auth-api.email_notification');
37
        $this->notify(new $emailTemplate);
0 ignored issues
show
Bug introduced by
It seems like notify() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

37
        $this->/** @scrutinizer ignore-call */ 
38
               notify(new $emailTemplate);
Loading history...
38
    }
39
40
    /**
41
     * Get the email address that should be used for verification.
42
     *
43
     * @return string
44
     */
45
    public function getEmailForVerification()
46
    {
47
        return $this->email;
48
    }
49
}
50