| Total Complexity | 4 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class UserDeleteAccountSubscriber extends AbstractUserSubscriber implements EventSubscriberInterface |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var SessionInterface |
||
| 17 | */ |
||
| 18 | private $session; |
||
| 19 | /** |
||
| 20 | * @var TokenStorageInterface |
||
| 21 | */ |
||
| 22 | private $tokenStorage; |
||
| 23 | |||
| 24 | public function __construct(SessionInterface $session, TokenStorageInterface $tokenStorage) |
||
| 25 | { |
||
| 26 | $this->session = $session; |
||
| 27 | $this->tokenStorage = $tokenStorage; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function deleteAccount(AbstractUserEvent $event) |
||
| 31 | { |
||
| 32 | $this->deleteFromDatabase($event); |
||
| 33 | } |
||
| 34 | |||
| 35 | public function removeSession() |
||
| 36 | { |
||
| 37 | $this->tokenStorage->setToken(null); |
||
| 38 | $this->session->invalidate(); |
||
| 39 | } |
||
| 40 | |||
| 41 | |||
| 42 | /** |
||
| 43 | * @return array The event names to listen to |
||
| 44 | */ |
||
| 45 | public static function getSubscribedEvents() |
||
| 51 | ], |
||
| 52 | ]; |
||
| 53 | } |
||
| 54 | } |