You are here

public function TraceableEventDispatcher::removeListener in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php \Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher::removeListener()

Removes an event listener from the specified events.

Parameters

string $eventName The event to remove a listener from:

callable $listener The listener to remove:

Overrides EventDispatcherInterface::removeListener

File

vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php, line 71

Class

TraceableEventDispatcher
Collects some data about event listeners.

Namespace

Symfony\Component\EventDispatcher\Debug

Code

public function removeListener($eventName, $listener) {
  if (isset($this->wrappedListeners[$eventName])) {
    foreach ($this->wrappedListeners[$eventName] as $index => $wrappedListener) {
      if ($wrappedListener
        ->getWrappedListener() === $listener) {
        $listener = $wrappedListener;
        unset($this->wrappedListeners[$eventName][$index]);
        break;
      }
    }
  }
  return $this->dispatcher
    ->removeListener($eventName, $listener);
}