*/ class RemoteWipeNotificationsListener implements IEventListener { /** @var INotificationManager */ private $notificationManager; /** @var ITimeFactory */ private $timeFactory; public function __construct(INotificationManager $notificationManager, ITimeFactory $timeFactory) { $this->notificationManager = $notificationManager; $this->timeFactory = $timeFactory; } public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->sendNotification('remote_wipe_start', $event->getToken()); } elseif ($event instanceof RemoteWipeFinished) { $this->sendNotification('remote_wipe_finish', $event->getToken()); } } private function sendNotification(string $event, IToken $token): void { $notification = $this->notificationManager->createNotification(); $notification->setApp('auth') ->setUser($token->getUID()) ->setDateTime($this->timeFactory->getDateTime()) ->setObject('token', (string)$token->getId()) ->setSubject($event, [ 'name' => $token->getName(), ]); $this->notificationManager->notify($notification); } }