vendor/symfony/security/Core/Exception/AuthenticationException.php line 22

Open in your IDE?
  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. use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
  12. /**
  13.  * AuthenticationException is the base class for all authentication exceptions.
  14.  *
  15.  * @author Fabien Potencier <fabien@symfony.com>
  16.  * @author Alexander <iam.asm89@gmail.com>
  17.  */
  18. class AuthenticationException extends \RuntimeException implements \Serializable
  19. {
  20.     private $token;
  21.     /**
  22.      * Get the token.
  23.      *
  24.      * @return TokenInterface|null
  25.      */
  26.     public function getToken()
  27.     {
  28.         return $this->token;
  29.     }
  30.     public function setToken(TokenInterface $token)
  31.     {
  32.         $this->token $token;
  33.     }
  34.     /**
  35.      * {@inheritdoc}
  36.      */
  37.     public function serialize()
  38.     {
  39.         $serialized = [
  40.             $this->token,
  41.             $this->code,
  42.             $this->message,
  43.             $this->file,
  44.             $this->line,
  45.         ];
  46.         return $this->doSerialize($serialized\func_num_args() ? func_get_arg(0) : null);
  47.     }
  48.     /**
  49.      * @internal
  50.      */
  51.     protected function doSerialize($serialized$isCalledFromOverridingMethod)
  52.     {
  53.         if (null === $isCalledFromOverridingMethod) {
  54.             $trace debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT3);
  55.             $isCalledFromOverridingMethod = isset($trace[2]['function'], $trace[2]['object']) && 'serialize' === $trace[2]['function'] && $this === $trace[2]['object'];
  56.         }
  57.         return $isCalledFromOverridingMethod $serialized serialize($serialized);
  58.     }
  59.     public function unserialize($str)
  60.     {
  61.         list(
  62.             $this->token,
  63.             $this->code,
  64.             $this->message,
  65.             $this->file,
  66.             $this->line
  67.         ) = \is_array($str) ? $str unserialize($str);
  68.     }
  69.     /**
  70.      * Message key to be used by the translation component.
  71.      *
  72.      * @return string
  73.      */
  74.     public function getMessageKey()
  75.     {
  76.         return 'An authentication exception occurred.';
  77.     }
  78.     /**
  79.      * Message data to be used by the translation component.
  80.      *
  81.      * @return array
  82.      */
  83.     public function getMessageData()
  84.     {
  85.         return [];
  86.     }
  87. }