You are here

public function EventDispatcher::getListeners in Zircon Profile 8.0

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

Gets the listeners of a specific event or all listeners sorted by descending priority.

Parameters

string $eventName The name of the event:

Return value

array The event listeners for the specified event, or all event listeners by event name

Overrides EventDispatcherInterface::getListeners

3 calls to EventDispatcher::getListeners()
ContainerAwareEventDispatcher::getListeners in vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
Gets the listeners of a specific event or all listeners sorted by descending priority.
EventDispatcher::dispatch in vendor/symfony/event-dispatcher/EventDispatcher.php
Dispatches an event to all registered listeners.
EventDispatcher::hasListeners in vendor/symfony/event-dispatcher/EventDispatcher.php
Checks whether an event has any registered listeners.
1 method overrides EventDispatcher::getListeners()
ContainerAwareEventDispatcher::getListeners in vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php
Gets the listeners of a specific event or all listeners sorted by descending priority.

File

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

Class

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

Namespace

Symfony\Component\EventDispatcher

Code

public function getListeners($eventName = null) {
  if (null !== $eventName) {
    if (!isset($this->listeners[$eventName])) {
      return array();
    }
    if (!isset($this->sorted[$eventName])) {
      $this
        ->sortListeners($eventName);
    }
    return $this->sorted[$eventName];
  }
  foreach ($this->listeners as $eventName => $eventListeners) {
    if (!isset($this->sorted[$eventName])) {
      $this
        ->sortListeners($eventName);
    }
  }
  return array_filter($this->sorted);
}