src/EventSubscriber/TZInjectInitSubscriber.php line 29

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use App\Utils\TimezoneInjection\TimezoneInjector;
  4. use Symfony\Component\Console\ConsoleEvents;
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Component\HttpKernel\KernelEvents;
  7. class TZInjectInitSubscriber implements EventSubscriberInterface
  8. {
  9.     /**
  10.      * @var TimezoneInjector
  11.      */
  12.     private $timezoneInjectable;
  13.     /**
  14.      * TZInjectInitSubscriber constructor.
  15.      * This class is a hack to initiate TimezoneInjector instance for the whole application.
  16.      */
  17.     public function __construct(TimezoneInjector $timezoneInjectable)
  18.     {
  19.         $this->timezoneInjectable $timezoneInjectable;
  20.     }
  21.     /**
  22.      * @param $event
  23.      */
  24.     public function onStart($event)
  25.     {
  26.     }
  27.     public static function getSubscribedEvents()
  28.     {
  29.         return [
  30.             KernelEvents::REQUEST => ['onStart', -100],
  31.             ConsoleEvents::COMMAND => ['onStart', -100],
  32.         ];
  33.     }
  34. }