Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mautic.corals.io/app/bundles/MessengerBundle/MessageHandler/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mautic.corals.io/app/bundles/MessengerBundle/MessageHandler/TestHandler.php
<?php

declare(strict_types=1);

namespace Mautic\MessengerBundle\MessageHandler;

use Doctrine\ORM\EntityManagerInterface;
use Mautic\CoreBundle\Model\NotificationModel;
use Mautic\MessengerBundle\Message\TestEmail;
use Mautic\MessengerBundle\Message\TestFailed;
use Mautic\MessengerBundle\Message\TestHit;
use Mautic\UserBundle\Entity\User;
use Symfony\Component\Messenger\Handler\MessageSubscriberInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
 * @deprecated since Mautic 5.0, to be removed in 6.0 with no replacement.
 */
class TestHandler implements MessageSubscriberInterface
{
    public function __construct(
        private NotificationModel $notificationModel,
        private EntityManagerInterface $entityManager,
        private TranslatorInterface $translator,
    ) {
    }

    /**
     * @return iterable<class-string, array<string, string>>
     */
    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),
        );
    }
}

Spamworldpro Mini