You are here

public function EventDispatcher::removeSubscriber in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/EventDispatcher.php \Symfony\Component\EventDispatcher\EventDispatcher::removeSubscriber()

Removes an event subscriber.

Parameters

EventSubscriberInterface $subscriber The subscriber:

Overrides EventDispatcherInterface::removeSubscriber

File

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

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],
      ));
    }
  }
}