Get the wildcard listeners for the event.

@param  string  $eventName
@return array
766087
protected function getWildcardListeners($eventName)
    {
        $wildcards = [];

        foreach ($this->wildcards as $key => $listeners) {
            $pattern = preg_quote($key, '#');
            $pattern = str_replace('\*', '.*', $pattern);
            if ($key == $value || preg_match('#^'.$pattern.'\z#u', $value)) {
                $wildcards = array_merge($wildcards, $listeners);
            }
        }

        return $wildcards;
    }
1017533
private function sortListeners(string $eventName = ''): MediatorInterface
    {
        if (0 === \count($this->listeners)) {
            return $this;
        }
        if ('' !== $eventName) {
            if (!\array_key_exists($eventName, $this->listeners)) {
                return $this;
            }
            $eventNames = [$eventName];
        } else {
            \ksort($this->listeners);
            $eventNames = \array_keys($this->listeners);
        }
        foreach ($eventNames as $anEvent) {
            \krsort($this->listeners[$anEvent], \SORT_NUMERIC);
        }
        return $this;
    }
682845
public function getAllActiveEvents(): array
    {
        $activeEvents = [];
        foreach (self::$eventsMap as $eventName => $eventClass) {
            if (!class_exists($eventClass)) {
                continue;
            }

            $activeEvents[] = $eventName;
        }

        $listeners = $this->eventDispatcher->getListeners();
        $activeEvents = array_unique(array_merge($activeEvents, array_keys($listeners)));

        asort($activeEvents);

        return $activeEvents;
    }
1226640
private function optimizeListeners(string $eventName): array
    {
        krsort($this->listeners[$eventName]);
        $this->optimized[$eventName] = [];

        foreach ($this->listeners[$eventName] as &$listeners) {
            foreach ($listeners as &$listener) {
                $closure = &$this->optimized[$eventName][];
                if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) {
                    $closure = static function (...$args) use (&$listener, &$closure) {
                        if ($listener[0] instanceof \Closure) {
                            $listener[0] = $listener[0]();
                        }
                        ($closure = \Closure::fromCallable($listener))(...$args);
                    };
                } else {
                    $closure = $listener instanceof \Closure || $listener instanceof WrappedListener ? $listener : \Closure::fromCallable($listener);
                }
            }
        }

        return $this->optimized[$eventName];
    }
54970
public function getListeners($name)
    {
        $listenerMatched = false;

        /**
         * Do we have an exact match?
         */
        if (isset($this->queues[$name])) {
            $listenerMatched = true;
        }

        /**
         * Optionally search for wildcard matches.
         */
        if ($this->wildcardSearching) {
            if ($this->populateQueueFromWildSearch($name)) {
                $listenerMatched = true;
            }
        }

        $listeners = [];
        if ($listenerMatched) {
            foreach ($this->queues[$name] as $key) {
                $listeners[] = $this->callbacks[$key];
            }
        }

        return $listeners;
    }
327666
public static function getEventNames($className)
    {
        $result = [];
        $reflection = new \ReflectionClass($className);
        foreach ($reflection->getConstants() as $name => $value) {
            if (!preg_match('/^EVENT/', $name)) {
                continue;
            }
            $result[$name] = $value;
        }
        return $result;
    }
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;
    }
389628
private function sortListeners($eventName)
    {
        $this->sorted[$eventName] = array();

        if (isset($this->listeners[$eventName])) {
            krsort($this->listeners[$eventName]);
            $this->sorted[$eventName] = call_user_func_array('array_merge', $this->listeners[$eventName]);
        }
    }
96997
function removeAllListeners(string $eventName = null) {

        if (!\is_null($eventName)) {
            unset($this->listeners[$eventName]);
            unset($this->listeners_flat[$eventName]);
        } else {
            $this->listeners = [];
            $this->listeners_flat = [];
        }

    }
581030
protected function getHandlers($eventName)
    {
        return isset($this->events[$eventName]) ? $this->events[$eventName] : new CallbackQueue();
    }
275230
public function listUserReceiveEvents(string $username): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/received_events', $username));
    }
1322728
public function getListeners(string $eventName = ''): array
    {
        $this->sortListeners($eventName);
        if ('' !== $eventName) {
            return \array_key_exists($eventName, $this->listeners) ? $this->listeners[$eventName] : [];
        }
        return $this->listeners;
    }
597850
public function listeners($event): array
    {
        $name = \get_class($event);

        $localListeners  = $this->events[$name] ?? [];
        $globalListeners = static::$globalEvents[$name] ?? [];

        return array_merge($globalListeners, $localListeners);
    }
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);
    }
919615
public function listeners(string $eventName): array
    {
        if (!\array_key_exists($eventName, $this->listenerIndex)) {
            // Create a new index.
            $listeners = [];
            $listenersPriority = [];
            if (isset($this->listeners[$eventName])) {
                foreach ($this->listeners[$eventName] as $listener) {
                    $listenersPriority[] = $listener[0];
                    $listeners[] = $listener[1];
                }
            }

            foreach ($this->wildcardListeners as $wcEvent => $wcListeners) {
                // Wildcard match
                if (\substr($eventName, 0, \strlen($wcEvent)) === $wcEvent) {
                    foreach ($wcListeners as $listener) {
                        $listenersPriority[] = $listener[0];
                        $listeners[] = $listener[1];
                    }
                }
            }

            // Sorting by priority
            \array_multisort($listenersPriority, SORT_NUMERIC, $listeners);

            // Creating index
            $this->listenerIndex[$eventName] = $listeners;
        }

        return $this->listenerIndex[$eventName];
    }
1119784
public function getEvent(string $name): array
    {
        return isset($this->events[$name]) ? $this->events[$name] : [];
    }
21450
private function executeListeners($eventName) {
        $listeners = $this->eventConfig[$eventName];
        foreach ($listeners as $listener) {
            $return = $this->classInvoker->invoke($listener);

            //如果某个事件监听器返回“false”，则停止事件的传播
            if ($return === false) {
                break;
            }
        }
    }