<?php declare(strict_types=1);
namespace App\Email\Listener;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Mailer\Event\MessageEvent;
class TestEmailListener implements EventSubscriberInterface
{
/**
* @var array<int, MessageEvent>
*/
private array $beforeSendEvents = [];
public function beforeSend(MessageEvent $evt): void
{
$this->beforeSendEvents[] = $evt;
}
/**
* @return array<int, MessageEvent>
*/
public function getBeforeSendResults(): array
{
return $this->beforeSendEvents;
}
/**
* @return array<string, array<int|string, array<int|string, int|string>|int|string>|string>
*/
public static function getSubscribedEvents(): array
{
return [
MessageEvent::class => ['beforeSend', -255],
];
}
}