| 1 | <?php |
||
| 8 | class PasswordResetToken |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $token; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * PasswordResetToken constructor. |
||
| 17 | * |
||
| 18 | * @param string|null $token |
||
| 19 | */ |
||
| 20 | public function __construct($token = null) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function getToken() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Generates a token string. |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | private function generateToken() |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param UserInterface $user |
||
| 49 | * @param $token |
||
| 50 | * |
||
| 51 | * @throws InvalidPasswordResetTokenException |
||
| 52 | * |
||
| 53 | * @return bool |
||
| 54 | */ |
||
| 55 | public static function validateToken(UserInterface $user, PasswordResetToken $token) |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Generates a PasswordToken |
||
| 66 | * |
||
| 67 | * @return PasswordResetToken |
||
| 68 | */ |
||
| 69 | public static function generate() |
||
| 73 | } |
||
| 74 |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
stringvalues, the empty string''is a special case, in particular the following results might be unexpected: