> */ public static function getHandledMessages(): iterable { yield TestEmail::class => ['method' => 'handleEmail']; yield TestHit::class => ['method' => 'handleHit']; yield TestFailed::class => ['method' => 'handleFailed']; } public function handleEmail(TestEmail $message): void { $this->sendNotification($message->userId, 'email'); } public function handleHit(TestHit $message): void { $this->sendNotification($message->userId, 'hit'); } public function handleFailed(TestFailed $message): void { $this->sendNotification($message->userId, 'failed'); } private function sendNotification(int $userId, string $type): void { $this->notificationModel->addNotification( $this->translator->trans('mautic.messenger.config.dsn.test_message_processed', ['%type%' => $type]), null, false, null, null, null, $this->entityManager->getReference(User::class, $userId), ); } }