Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
27 | 3 | public function create(AbstractUser $user, array $context = []): ?RawMessage |
|
28 | { |
||
29 | 3 | if (!$this->enabled) { |
|
30 | 1 | return null; |
|
31 | } |
||
32 | |||
33 | 2 | $this->initUser($user); |
|
34 | |||
35 | 2 | $token = $user->plainNewEmailConfirmationToken; |
|
36 | 2 | $user->plainNewEmailConfirmationToken = null; |
|
37 | 2 | if (!$token) { |
|
38 | 1 | throw new InvalidArgumentException('A `new email confirmation token` must be set to send the confirmation email'); |
|
39 | } |
||
40 | |||
41 | 1 | $context['redirect_url'] = $this->getTokenUrl($token, $user->getUsername(), $user->getNewEmailAddress()); |
|
|
|||
42 | |||
43 | 1 | return $this->createEmailMessage($context); |
|
44 | } |
||
58 |