Get a list of listeners for a specific event

@param   string  		The event name
@return  AnObjectQueue	An object queue containing the listeners
542103
public function getListeners($name)
    {
        $result = array();
        if (isset($this->_listeners[$name])) {
            $result = $this->_listeners[$name];
        }
        
        return $result;
    }
581030
protected function getHandlers($eventName)
    {
        return isset($this->events[$eventName]) ? $this->events[$eventName] : new CallbackQueue();
    }
923050
private function getListenersForEvent($event) {
        $listeners = [];

        foreach ($this->getEventNameParts($event) as $name) {
            if (isset($this->callbacks[$name])) {
                foreach (clone $this->callbacks[$name] as $listener) {
                    $listeners[] = $listener;
                }
            }
        }

        return $listeners;
    }
446644
private ArrayList getListener()
    {
        if (_listeners != null)
            return _listeners;
        synchronized (this) {
            if (_listeners != null)
                return _listeners;
            _listeners = new ArrayList();
        }
        return _listeners;
    }
94211
public function getListners($name)
    {
        if (! $this->hasListener($name)) return [];

        $listeners = [];
        krsort($this->listeners[$name]);
        foreach ($this->listeners[$name] as $_listeners) {
            $listeners = array_merge($listeners, $_listeners);
        }

        return $listeners;
    }
1345418
public function getListeners($event): array
    {
        $event = $this->getEventName($event);

        if (! $this->hasListener($event)) {
            return [];
        }

        if (! array_key_exists($event, $this->sortedListeners)) {
            $listeners = $this->listeners[$event];

            krsort($listeners);

            $listeners = call_user_func_array(
                'array_merge',
                $listeners
            );
            $this->sortedListeners[$event] = $listeners;

            unset($listeners);
        }

        return $this->sortedListeners[$event];
    }
162182
public function dispatchEvent($name, $event = array())
    {
        $result = array();
        
        //Make sure we have an event object
        if (! $event instanceof AnEvent) {
            $event = new AnEvent($event);
        }
        
        $event->setName($name)->setDispatcher($this);
             
        //Nofity the listeners
        if (isset($this->_listeners[$name])) {
            foreach ($this->_listeners[$name] as $listener) {
                $listener->$name($event);
                
                if (! $event->canPropagate()) {
                    break;
                }
            }
        }
        
        return $this;
    }
820101
private function resolveEventAndListeners($event)
    {

        if (is_object($event) && $event instanceof EventDispatch) {
            $name = get_class($event);
        } else {
            $name = $event;
        }

        if (is_string($name)) {
            if ($this->hasListiner($name) && $listeners = $this->getListeners($name)) {
                if (count($listeners) === 1) {
                    $listeners = $listeners[0];
                    $listeners = [$listeners instanceof Closure ? $listeners : (new $listeners)];
                }
            } else {
                throw new EventListenerException(sprintf('Your %s event havent got listener', $event));
            }
        }

        return [$listeners, $event];
    }
1181393
public function getListeners($eventName = null) {

        if ($eventName) {

            if (empty($this->registry[$eventName])) {
                return [];
            }

            return $this->getSortedRegistry($eventName);

        }

        foreach ($this->registry as $eventName => $listeners) {
            $this->getSortedRegistry($eventName);
        }

        return $this->sortedRegistry;

    }
868937
public function listenersAction()
    {
        $dispatcher = $this->get('event_dispatcher');

        $listenerNames = array_keys($dispatcher->getListeners());
        sort($listenerNames);

        $output = '<pre>';
        $output .= str_repeat('=', 3).str_pad(' Events / Listeners ', 80, '=').PHP_EOL.PHP_EOL;

        foreach ($listenerNames as $listenerName) {
            $listeners = $dispatcher->getListeners($listenerName);

            $output .= $listenerName.' (<a href="#'.$listenerName.'">'.count($listeners).' listeners</a>)'.PHP_EOL;
        }

        foreach ($listenerNames as $listenerName) {
            $listeners = $dispatcher->getListeners($listenerName);

            if (!$listenerName) {
                $listenerName = '(global)';
            }

            $output .= PHP_EOL.PHP_EOL.str_repeat('-', 3).'<a name="'.$listenerName.'"></a>'.str_pad(' '.$listenerName.' ', 80, '-').PHP_EOL.PHP_EOL;

            foreach ($listeners as $listener) {
                if (is_array($listener)) {
                    if (is_object($listener[0])) {
                        $listener = get_class($listener[0]).'->'.$listener[1].'()';
                    } else {
                        $listener = implode('::', $listener).'()';
                    }
                }
                $output .= '* '.$listener.PHP_EOL;
            }
        }

        return new Response($output);
    }
706983
protected function sortListeners($eventName)
    {
        // If listeners exist for the given event, we will sort them by the priority
        // so that we can call them in the correct order. We will cache off these
        // sorted event listeners so we do not have to re-sort on every events.
        $listeners = isset($this->listeners[$eventName])
                            ? $this->listeners[$eventName] : [];

        if (class_exists($eventName)) {
            foreach (class_implements($eventName) as $interface) {
                if (isset($this->listeners[$interface])) {
                    foreach ($this->listeners[$interface] as $priority => $names) {
                        if (isset($listeners[$priority])) {
                            $listeners[$priority] = array_merge($listeners[$priority], $names);
                        } else {
                            $listeners[$priority] = $names;
                        }
                    }
                }
            }
        }

        if ($listeners) {
            krsort($listeners);

            $this->sorted[$eventName] = call_user_func_array('array_merge', $listeners);
        } else {
            $this->sorted[$eventName] = [];
        }
    }
26004
public function listen($name, $listenerInterface)
    {

        $name = is_object($name) ? get_class($name) : $name;

        if ($listenerInterface instanceof EventListener && $listenerInterface instanceof SubscriberInterface) {
            $listeners = $listenerInterface->getSubscribedEvents();

            foreach ($listeners as $listener => $callback) {
                if (!$callback instanceof Closure) {
                    $callback = [$listenerInterface, $callback];
                }

                if(is_integer($listener)){
                    EventCollector::addListener($name, $callback);

                }else{
                    EventCollector::addListener($name.'.'.$listener, $callback);
                }
            }

        } else {
            EventCollector::addListener($name, $listenerInterface);
        }

        return $this;
    }
1025269
protected function matchEventQueues(
        /*# string */ $eventName
    )/*: EventQueueInterface */ {
        $nqueue = $this->newEventQueue();
        $names  = $this->globbingNames($eventName, $this->getEventNames());
        foreach ($names as $evtName) {
            if ($this->hasEvent($evtName)) {
                $nqueue = $nqueue->combine($this->events[$evtName]);
            }
        }
        return $nqueue;
    }
650204
function listeners(type) {
      var object = this,
          events = object.events || (object.events = {});

      return _.has(events, type) ? events[type] : (events[type] = []);
    }
918571
public static function getEventListeners()
    {
        $listeners = array();

        $reflection = new ReflectionClass(get_called_class());
        foreach ($reflection->getMethods(ReflectionMethod::IS_PUBLIC) as $method)
        {
            if(substr($method->name, 0, 2) == 'on') {
               $listeners[] = $method->name;
            }
        }

        return $listeners;
    }
453166
protected function getListeners(Event $eventObject) {
        $listeners = $this->getOption(self::OPTION_LISTENERS);
        return isset($listeners[$eventObject->getName()])
            ? $listeners[$eventObject->getName()]
            : array();
    }
183205
public function getListeners($resultType = self::FULL_RESULT)
    {
        $listeners = [];

        foreach ($this->getEventDispatcher()->getListeners(CronEvent::NAME) as $listener) {
            $listenerClass = get_class($listener[0]);

            if (!$listener[0] instanceof CronEventListenerInterface) {
                $this->getLogger()->addError(sprintf('%s without %s', $listenerClass, CronEventListenerInterface::class));

                continue;
            }

            if (self::FLAT_RESULT === $resultType) {
                $listeners[] = $listenerClass;

                continue;
            }

            $type = $listener[0]::getRepeatedType();
            if (false === isset($listeners[$type])) {
                $listeners[$type] = [];
            }

            $listeners[$type][] = $listenerClass;
        }

        return $listeners;
    }