<?php
namespace App\EventSubscriber\Royalty;
use App\Event\Royalty\BadPublisherAdministratorEvent;
use App\Service\Mailer\RoyaltyMailer;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class RoyaltySubscriber implements EventSubscriberInterface
{
/** @var RoyaltyMailer */
private $royaltyMailer;
public function __construct(RoyaltyMailer $royaltyMailer)
{
$this->royaltyMailer = $royaltyMailer;
}
/**
* @inheritDoc
*/
public static function getSubscribedEvents(): array
{
return [
BadPublisherAdministratorEvent::class => "onBadPublisherAdministrator",
];
}
public function onBadPublisherAdministrator(BadPublisherAdministratorEvent $event): void
{
$this->royaltyMailer->sendProfileNotificationEmail($event->getMessage());
}
}