You are here

public function ContainerAwareEventDispatcher::hasListeners in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher::hasListeners()
  2. 8 core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php \Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::hasListeners()
Same name and namespace in other branches
  1. 8.0 vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher::hasListeners()

Checks whether an event has any registered listeners.

Parameters

string $eventName The name of the event:

Return value

bool true if the specified event has any listeners, false otherwise

Overrides EventDispatcher::hasListeners

File

vendor/symfony/event-dispatcher/ContainerAwareEventDispatcher.php, line 105

Class

ContainerAwareEventDispatcher
Lazily loads listeners and subscribers from the dependency injection container.

Namespace

Symfony\Component\EventDispatcher

Code

public function hasListeners($eventName = null) {
  if (null === $eventName) {
    return (bool) count($this->listenerIds) || (bool) count($this->listeners);
  }
  if (isset($this->listenerIds[$eventName])) {
    return true;
  }
  return parent::hasListeners($eventName);
}