public function ContainerAwareEventDispatcher::removeSubscriber in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::removeSubscriber()
 
File
- core/
lib/ Drupal/ Component/ EventDispatcher/ ContainerAwareEventDispatcher.php, line 308  
Class
- ContainerAwareEventDispatcher
 - A performance optimized container aware event dispatcher.
 
Namespace
Drupal\Component\EventDispatcherCode
public function removeSubscriber(EventSubscriberInterface $subscriber) {
  foreach ($subscriber
    ->getSubscribedEvents() as $event_name => $params) {
    if (is_array($params) && is_array($params[0])) {
      foreach ($params as $listener) {
        $this
          ->removeListener($event_name, [
          $subscriber,
          $listener[0],
        ]);
      }
    }
    else {
      $this
        ->removeListener($event_name, [
        $subscriber,
        is_string($params) ? $params : $params[0],
      ]);
    }
  }
}