8.5.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.0.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.1.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.2.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.3.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.4.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)
8.6.x EventDispatcher.php EventDispatcher::removeSubscriber(EventSubscriberInterface $subscriber)

Removes an event subscriber.

Parameters

EventSubscriberInterface $subscriber The subscriber:

Overrides EventDispatcherInterface::removeSubscriber

File

vendor/symfony/event-dispatcher/EventDispatcher.php, line 155

Class

EventDispatcher
The EventDispatcherInterface is the central point of Symfony's event listener system.

Namespace

Symfony\Component\EventDispatcher

Code

public function removeSubscriber(EventSubscriberInterface $subscriber) {
  foreach ($subscriber
    ->getSubscribedEvents() as $eventName => $params) {
    if (is_array($params) && is_array($params[0])) {
      foreach ($params as $listener) {
        $this
          ->removeListener($eventName, array(
          $subscriber,
          $listener[0],
        ));
      }
    }
    else {
      $this
        ->removeListener($eventName, array(
        $subscriber,
        is_string($params) ? $params : $params[0],
      ));
    }
  }
}