Collect all event listeners for the given event including inherited listeners.

@param mixed $event Event object or name.
@return \SplPriorityQueue
172805
protected function collectListeners($event)
	{
		$tmp = is_object($event) ? get_class($event) : (string)$event;
		
		if(isset($this->listeners[$tmp]))
		{
			$listeners = clone $this->listeners[$tmp];
		}
		else
		{
			$listeners = new \SplPriorityQueue();
		}
		
		while(false !== ($tmp = get_parent_class($tmp)))
		{
			if(isset($this->listeners[$tmp]) && !$this->listeners[$tmp]->isEmpty())
			{
				foreach(clone $this->listeners[$tmp] as $listener)
				{
					$listeners->insert($listener, $listener->getPriority());
				}
			}
		}
		
		return $listeners;
	}
625964
protected function getSortedListeners($event)
    {
        if (! $this->hasListeners($event)) {
            return [];
        }

        $listeners = $this->listeners[$event] ?? [];

        if ($event !== '*') {
            $namesWithWildcard = array_filter(array_keys($this->listeners), function ($name) {
                return $name !== '*' && strpos($name, '*') !== false;
            });
            foreach ($namesWithWildcard as $name) {
                if (StringHelper::matchWildcard('*', $name)) {
                    $listeners = array_merge($listeners, $this->listeners[$name]);
                }
            }
        }

        if (empty($listeners)) {
            return [];
        }

        krsort($listeners);

        return call_user_func_array('array_merge', $listeners);
    }
1096900
public function getListeners($event): array
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

        if (isset($this->listeners[$event])) {
            return $this->listeners[$event]->getAll();
        }

        return [];
    }
713015
public function dispatchEvent($event, $parameters = array()) {
        if (is_string($event)) {
            $event = new BaseEvent($event, $parameters);
        }
        $eventName = $event->getName();
        $event->setDispatcher($this);
        if ($this->hasListeners($eventName)) {
            foreach($this->_listeners[$eventName] as $priority=>$listeners) {
                foreach($listeners as $listener) {
                    if ($event->isPropagationStopped($priority)) {
                        break;
                    }
                    call_user_func($listener, $event);
                }
            }
        }
        return $event;
    }
294978
public function onParentRefIdChanged($event)
    {
        $sender = $event->sender;
        /* @var $sender static */
        if ($sender->isAttributeChanged($sender->refIdAttribute)) {
            return $sender->onUpdateChildren($event);
        }
    }
1008128
public static function getRegistered($event) {
            $listeners = [];
            foreach (self::$listeners as $ev => $registered_listeners) {
                if ($ev & $event) {
                    $listeners = array_merge($listeners, $registered_listeners);
                }
            }

            return $listeners;
        }
554194
public function getListeners(string $event)
    {
        if (isset($this->listeners[$event])) {
            return $this->listeners[$event];
        } elseif (isset($this->classListeners[$event])) {
            return $this->classListeners[$event];
        }

        return [];
    }
162212
protected function sendEventThroughSenders(Event $event)
    {
        foreach ($this->eventSenders as $sender) {
            try {
                $sender->send($event);
            } catch (\Exception $exception) {
                $this->logException($exception);
            }
        }

        return $this;
    }
1140200
public function handleApiEvent($event)
    {
        $eventName = str_replace('.queued', null, $event->name);
        $ckey = 'event:' . $eventName;
        $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($eventName) {
            return ServiceEventMap::whereEvent($eventName)->get()->all();
        });
        if (empty($records)) {
            // Look for wildcard events by service (example: user.*)
            $serviceName = substr($eventName, 0, strpos($eventName, '.'));
            $wildcardEvent = $serviceName . '.*';
            $ckey = 'event:' . $wildcardEvent;
            $records = Cache::remember($ckey, Config::get('df.default_cache_ttl'), function () use ($wildcardEvent) {
                return ServiceEventMap::whereEvent($wildcardEvent)->get()->all();
            });
        }

        /** @var BaseModel $record */
        foreach ($records as $record) {
            Log::debug('Service event handled: ' . $eventName);
            /** @var BaseRestService $service */
            $service = \ServiceManager::getServiceById($record->service_id);
            Event::fire(new ServiceAssignedEvent($service, $event, $record->toArray()));
        }
    }
1363062
public function getEvent(string $event)
    {
        $class = (string)$this->sprintf(':namespace\Event\:event', __NAMESPACE__, $event);

        if (class_exists($class)) {
            return new $class($this);
        }

        return null;
    }
99148
public function getSubscribers($event)
    {
        $result = array();
        if(isset($this->__listeners[$event])) {
            $result = $this->__listeners[$event];
        }

        return $result;
    }
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];
    }
684190
function byEvent($event)
    {
        if (! $this->has($event) ) {
            if ($event instanceof iEvent)
                $this->bind($event);
            else 
                throw new \Exception("Events ({$event}) not found.");
        }

        $event = ($event instanceof iEvent) ? $event->getName() : $event;
        /** @var iEvent $event */
        $event = $this->attached_events[$event];
        if ($this->meeter)
            // Use Same Meeter For Bind Events
            $event->setMeeter($this->meeter);

        return $event;
    }
967166
public function getListeners(AbstractEvent $event, $asynchronous = false)
    {
        return array_filter(
            $this->listeners,
            function (EventListener $eventSubscriber) use ($asynchronous, $event) {
                $supportedEvent = $eventSubscriber->getEventClassName();

                if ($eventSubscriber->isAsynchronous() !== $asynchronous) {
                    return false;
                }
                if (null === $supportedEvent) {
                    return true;
                }

                return $event instanceof $supportedEvent;
            }
        );
    }
609492
public function dispatchEvent($event) {
		$type = $event->getType();
		if (isset($this->eventsListeners[$type])) {
			for ($j = 0; $j < count($this->eventsListeners[$type]); $j++) {
				list($plugin, $action) = explode(':', $this->eventsListeners[$type][$j]);
				//加载plugin && 调用action
				//echo $type.'<br/>';
				$this->app->runPluginAction($plugin, $action, $event);
			}
		}
		
	}
675423
public function trigger($event, \Closure $callback = null)
    {
        $results = [];

        if (!$event instanceof EventInterface) {
            $event = new Event($event);
        }

        if ($listeners = $this->getListeners($event->getName())) {
            foreach ($listeners as $listener) {
                $result = call_user_func($listener, $event);
                if ($result instanceof EventInterface) {
                    // Save result
                    $results[] = clone $result;

                    // Was the queue halted early ?
                    if ($result->isQueueHaltedEarly()) {
                        return $this;
                    }

                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }

                    // Was the queue halted ?
                    if ($result->isQueueHalted()) {
                        return $this;
                    }
                } else {
                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }
                }
            }
        }
        if ($results) {
            return $results;
        }

        return false;
    }
1072221
public function dispatch($event)
    {
        if ($event instanceof AbstractEvent) {
            $this->dispatcher->dispatch($event->getEventName(), $event);
        } else {
            $this->dispatcher->dispatch($event);
        }
        return $this;
    }