Format list of event listeners.

@param  string  $eventName
@return array
333245
protected function formatListeners($eventName)
    {
        return collect(app('events')->getListeners($eventName))
            ->map(function ($listener) {
                $listener = (new ReflectionFunction($listener))
                        ->getStaticVariables()['listener'];

                if (is_string($listener)) {
                    return Str::contains($listener, '@') ? $listener : $listener.'@handle';
                } elseif (is_array($listener)) {
                    return get_class($listener[0]).'@'.$listener[1];
                }

                return $this->formatClosureListener($listener);
            })->reject(function ($listener) {
                return Str::contains($listener, 'Laravel\\Telescope');
            })->map(function ($listener) {
                if (Str::contains($listener, '@')) {
                    $queued = in_array(ShouldQueue::class, class_implements(explode('@', $listener)[0]));
                }

                return [
                    'name' => $listener,
                    'queued' => $queued ?? false,
                ];
            })->values()->toArray();
    }
579957
public function listUserPerformedEvents(string $username): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/users/:username/events', $username));
    }
527053
public function removeAllListeners(string $eventName = null)
    {
        if (!\is_null($eventName)) {
            unset($this->listeners[$eventName]);
        } else {
            $this->listeners = [];
        }
    }
101021
protected function getWildcardListeners($eventName)
	{
		$wildcards = array();

		foreach ($this->wildcards as $key => $listeners)
		{
			if (str_is($key, $eventName)) $wildcards = array_merge($wildcards, $listeners);
		}

		return $wildcards;
	}
1096900
public function getListeners($event): array
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

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

        return [];
    }
643840
private function getEventStructure($eventName)
    {
        if (!$this->dumpSettings['skip-comments']) {
            $ret = "--".PHP_EOL.
                "-- Dumping events for database '".$this->dbName."'".PHP_EOL.
                "--".PHP_EOL.PHP_EOL;
            $this->compressManager->write($ret);
        }
        $stmt = $this->typeAdapter->show_create_event($eventName);
        foreach ($this->dbHandler->query($stmt) as $r) {
            $this->compressManager->write(
                $this->typeAdapter->create_event($r)
            );
            return;
        }
    }
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 = [];
        }

    }
303267
public function getEventTypes($eventName) {
        $filter = is_array($eventName) ? $eventName : array(
            'EVENT_NAME' => $eventName,
        );

        $dbres = \CEventType::GetList($filter);
        return $this->fetchAll($dbres);
    }
133938
function listeners(string $eventName, bool $flat=false) : array {

        if (!isset($this->listeners[$eventName])) {
            return [];
        }

        // The list is not sorted
        if (!$this->listeners[$eventName][0]) {

            // Sorting
            \array_multisort($this->listeners[$eventName][1], SORT_NUMERIC, $this->listeners[$eventName][2]);
            \array_multisort($this->listeners_flat[$eventName][1], SORT_NUMERIC, $this->listeners_flat[$eventName][2]);

            // Marking the listeners as sorted
            $this->listeners[$eventName][0] = true;
            $this->listeners_flat[$eventName][0] = true;
        }

        if(!$flat)
            return $this->listeners[$eventName][2];
        else
            return $this->listeners_flat[$eventName][2];

    }
634212
protected function getEventListeners($eventName)
    {
        $results = [];

        foreach ($this->eventDispatcher->getListeners($eventName) as $listener) {
            if ($listener instanceof \Closure) {
                $results[] = '{closure}()';
            } elseif (\is_object($listener[0])) {
                $results[] = \get_class($listener[0]);
            } elseif (\is_string($listener[0])) {
                $results[] = $listener[0];
            } else {
                $results[] = 'Unknown type!';
            }
        }

        return $results;
    }
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;
    }
891507
public function cleanEventName($eventName)
    {
        $eventName = strtolower($eventName);
        $eventName = str_replace('..', '.', $eventName);
        $eventName = trim($eventName, '.');
        $eventName = trim($eventName);

        if (!$eventName) {
            throw new Exception('Event name is empty!');
        }

        return $eventName;
    }
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;

    }
1190104
public function getListeners($eventName = NULL)
	{
		if($eventName === NULL)
		{
			$listeners = [];
			
			foreach(array_keys($this->listeners) as $k)
			{
				$listeners[$k] = [];
				
				foreach(clone $this->listeners[$k] as $listener)
				{
					$listeners[$k][] = $listener;
				}
			}
			
			ksort($listeners);
			
			return $listeners;
		}
		
		if($eventName instanceof \ReflectionClass)
		{
			$eventName = $eventName->name;
		}
		
		if(empty($this->listeners[$eventName]))
		{
			return [];
		}
		
		$listeners = [];
		
		foreach(clone $this->listeners[$eventName] as $listener)
		{
			$listeners[] = $listener;
		}
		
		return $listeners;
	}
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;
    }
1334609
protected function addInterfaceListeners($eventName, array $listeners = [])
    {
        foreach (class_implements($eventName) as $interface) {
            if (isset($this->listeners[$interface])) {
                foreach ($this->listeners[$interface] as $names) {
                    $listeners = array_merge($listeners, (array) $names);
                }
            }
        }

        return $listeners;
    }
21450
private function executeListeners($eventName) {
        $listeners = $this->eventConfig[$eventName];
        foreach ($listeners as $listener) {
            $return = $this->classInvoker->invoke($listener);

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