/** * @param EventInterface $event * @param EventSubscriberInterface $subscriber */ protected function dispatch(EventInterface $event, EventSubscriberInterface $subscriber) { $subscribedEvents = $subscriber->getSubscribedEvents(); foreach ($subscribedEvents as $eventName => $method) { if ($eventName == $event->getEventName()) { $subscriber->{$method}($event); } } }