private function ContainerAwareTraceableEventDispatcher::getListenerInfo

Returns information about the listener

Parameters

object $listener The listener:

string $eventName The event name:

Return value

array Informations about the listener

2 calls to ContainerAwareTraceableEventDispatcher::getListenerInfo()
ContainerAwareTraceableEventDispatcher::doDispatch in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php
Triggers the listeners of an event.
ContainerAwareTraceableEventDispatcher::getNotCalledListeners in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php
Gets the not called listeners.

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php, line 214

Class

ContainerAwareTraceableEventDispatcher
Extends the ContainerAwareEventDispatcher to add some debugging tools.

Namespace

Symfony\Component\HttpKernel\Debug

Code

private function getListenerInfo($listener, $eventName) {
  $info = array(
    'event' => $eventName,
    'priority' => $this->priorities[$eventName . '_' . $this
      ->getListenerAsString($listener)],
  );
  if ($listener instanceof \Closure) {
    $info += array(
      'type' => 'Closure',
      'pretty' => 'closure',
    );
  }
  elseif (is_string($listener)) {
    try {
      $r = new \ReflectionFunction($listener);
      $file = $r
        ->getFileName();
      $line = $r
        ->getStartLine();
    } catch (\ReflectionException $e) {
      $file = null;
      $line = null;
    }
    $info += array(
      'type' => 'Function',
      'function' => $listener,
      'file' => $file,
      'line' => $line,
      'pretty' => $listener,
    );
  }
  elseif (is_array($listener) || is_object($listener) && is_callable($listener)) {
    if (!is_array($listener)) {
      $listener = array(
        $listener,
        '__invoke',
      );
    }
    $class = is_object($listener[0]) ? get_class($listener[0]) : $listener[0];
    try {
      $r = new \ReflectionMethod($class, $listener[1]);
      $file = $r
        ->getFileName();
      $line = $r
        ->getStartLine();
    } catch (\ReflectionException $e) {
      $file = null;
      $line = null;
    }
    $info += array(
      'type' => 'Method',
      'class' => $class,
      'method' => $listener[1],
      'file' => $file,
      'line' => $line,
      'pretty' => $class . '::' . $listener[1],
    );
  }
  return $info;
}