<?php
namespace FlexApp\EventSubscriber;
use FlexApp\Events\UserHasEnteredTheChatEvent;
use FlexApp\Service\PortalNotifierAboutChatEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use WebBundle\Exception\PortalHelperException;
class PortalNotifierAboutJobSeekerHasEnteredTheChatSubscriber implements EventSubscriberInterface
{
/**
* @var PortalNotifierAboutChatEvents
*/
private $portalNotifierAboutChatEvents;
/**
* @param PortalNotifierAboutChatEvents $portalNotifierAboutChatEvents
*/
public function __construct(PortalNotifierAboutChatEvents $portalNotifierAboutChatEvents)
{
$this->portalNotifierAboutChatEvents = $portalNotifierAboutChatEvents;
}
/**
* @param UserHasEnteredTheChatEvent $event
*
* @throws PortalHelperException
*/
public function notifyPortal(UserHasEnteredTheChatEvent $event)
{
$this->portalNotifierAboutChatEvents->notify($event, 'Соискатель вошёл в чат');
}
public static function getSubscribedEvents()
{
return [
UserHasEnteredTheChatEvent::class => 'notifyPortal',
];
}
}