WithEmailChangeVerification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 24
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getEmailForChangeEmail() 0 3 1
A sendEmailChangeNotification() 0 3 1
1
<?php
2
3
namespace EmailChangeVerification\User;
4
5
use EmailChangeVerification\Notifications\EmailChangeNotification;
6
7
trait WithEmailChangeVerification
8
{
9
10
    /**
11
     * Get the e-mail address where email change verification links are sent.
12
     *
13
     * @return string
14
     */
15 14
    public function getEmailForChangeEmail(): string
16
    {
17 14
        return $this->email;
18
    }
19
20
    /**
21
     * Send the verification notification.
22
     *
23
     * @param string $token
24
     * @param string $newEmail
25
     *
26
     * @return void
27
     */
28 5
    public function sendEmailChangeNotification(string $token, string $newEmail): void
29
    {
30 5
        $this->notify(new EmailChangeNotification($token, $newEmail));
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

30
        $this->/** @scrutinizer ignore-call */ 
31
               notify(new EmailChangeNotification($token, $newEmail));
Loading history...
31
    }
32
}
33