vendor/symfony/security-core/Exception/UserNotFoundException.php line 20

  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Security\Core\Exception;
  11. /**
  12.  * UserNotFoundException is thrown if a User cannot be found for the given identifier.
  13.  *
  14.  * @author Fabien Potencier <fabien@symfony.com>
  15.  * @author Alexander <iam.asm89@gmail.com>
  16.  */
  17. class UserNotFoundException extends AuthenticationException
  18. {
  19.     private ?string $identifier null;
  20.     public function getMessageKey(): string
  21.     {
  22.         return 'Username could not be found.';
  23.     }
  24.     /**
  25.      * Get the user identifier (e.g. username or email address).
  26.      */
  27.     public function getUserIdentifier(): ?string
  28.     {
  29.         return $this->identifier;
  30.     }
  31.     /**
  32.      * Set the user identifier (e.g. username or email address).
  33.      */
  34.     public function setUserIdentifier(string $identifier): void
  35.     {
  36.         $this->identifier $identifier;
  37.     }
  38.     public function getMessageData(): array
  39.     {
  40.         return ['{{ username }}' => $this->identifier'{{ user_identifier }}' => $this->identifier];
  41.     }
  42.     public function __serialize(): array
  43.     {
  44.         return [$this->identifierparent::__serialize()];
  45.     }
  46.     public function __unserialize(array $data): void
  47.     {
  48.         [$this->identifier$parentData] = $data;
  49.         $parentData \is_array($parentData) ? $parentData unserialize($parentData);
  50.         parent::__unserialize($parentData);
  51.     }
  52. }