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

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. /**
  12.  * This exception is thrown if there where too many failed login attempts in
  13.  * this session.
  14.  *
  15.  * @author Wouter de Jong <wouter@wouterj.nl>
  16.  */
  17. class TooManyLoginAttemptsAuthenticationException extends AuthenticationException
  18. {
  19.     private $threshold;
  20.     public function __construct(int $threshold null)
  21.     {
  22.         $this->threshold $threshold;
  23.     }
  24.     /**
  25.      * {@inheritdoc}
  26.      */
  27.     public function getMessageData(): array
  28.     {
  29.         return [
  30.             '%minutes%' => $this->threshold,
  31.             '%count%' => (int) $this->threshold,
  32.         ];
  33.     }
  34.     /**
  35.      * {@inheritdoc}
  36.      */
  37.     public function getMessageKey(): string
  38.     {
  39.         return 'Too many failed login attempts, please try again '.($this->threshold 'in %minutes% minute'.($this->threshold 's' '').'.' 'later.');
  40.     }
  41.     /**
  42.      * {@inheritdoc}
  43.      */
  44.     public function __serialize(): array
  45.     {
  46.         return [$this->thresholdparent::__serialize()];
  47.     }
  48.     /**
  49.      * {@inheritdoc}
  50.      */
  51.     public function __unserialize(array $data): void
  52.     {
  53.         [$this->threshold$parentData] = $data;
  54.         $parentData \is_array($parentData) ? $parentData unserialize($parentData);
  55.         parent::__unserialize($parentData);
  56.     }
  57. }