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