src/EventSubscriber/KernelEventSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Service\Calendar\Rrule\RrulePostProcessService;
  4. use App\Service\Sign\UserSignAlertService;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Component\HttpKernel\Event\TerminateEvent;
  7. use Symfony\Component\HttpKernel\KernelEvents;
  8. class KernelEventSubscriber implements EventSubscriberInterface
  9. {
  10.     public function __construct(
  11.         private UserSignAlertService    $userSignAlertService,
  12.         private RrulePostProcessService $rrulePostProcessService,
  13.     )
  14.     {
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             KernelEvents::TERMINATE => '__invoke',
  20.         ];
  21.     }
  22.     public function __invoke(TerminateEvent $terminateEvent): void
  23.     {
  24.         if ($this->rrulePostProcessService->shouldPostProcess()) {
  25.             $this->rrulePostProcessService->postProcess();
  26.         }
  27.         if ($this->userSignAlertService->shouldProcess()) {
  28.             $this->userSignAlertService->processAll();
  29.         }
  30.     }
  31. }