AccountStatusException.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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\User\UserInterface;
  12. /**
  13. * AccountStatusException is the base class for authentication exceptions
  14. * caused by the user account status.
  15. *
  16. * @author Fabien Potencier <fabien@symfony.com>
  17. * @author Alexander <iam.asm89@gmail.com>
  18. */
  19. abstract class AccountStatusException extends AuthenticationException
  20. {
  21. private $user;
  22. /**
  23. * Get the user.
  24. *
  25. * @return UserInterface
  26. */
  27. public function getUser()
  28. {
  29. return $this->user;
  30. }
  31. public function setUser(UserInterface $user)
  32. {
  33. $this->user = $user;
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function serialize()
  39. {
  40. return serialize(array(
  41. $this->user,
  42. parent::serialize(),
  43. ));
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function unserialize($str)
  49. {
  50. list($this->user, $parentData) = unserialize($str);
  51. parent::unserialize($parentData);
  52. }
  53. }