src/Viserio/Component/Events/EventManager.php
public function getListeners(string $eventName = null): array
    {
        if ($eventName === null) {
            foreach ($this->listeners as $name => $eventListeners) {
                if (! isset($this->sorted[$name])) {
                    $this->sortListeners($name);
                }
            }

            return \array_filter($this->sorted);
        }

        $this->validateEventName($eventName);

        $this->bindPatterns($eventName);

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

        if (! isset($this->sorted[$eventName])) {
            $this->sortListeners($eventName);
        }

        return $this->sorted[$eventName];
    }
public function getListeners(string $eventName = null): array
    {
        if ($eventName === null) {
            foreach ($this->listeners as $name => $eventListeners) {
                if (! isset($this->sorted[$name])) {
                    $this->sortListeners($name);
                }
            }

            return \array_filter($this->sorted);
        }

        $this->validateEventName($eventName);

        $this->bindPatterns($eventName);

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

        if (! isset($this->sorted[$eventName])) {
            $this->sortListeners($eventName);
        }

        return $this->sorted[$eventName];
    }
Returns the list of listeners for an event.

The list is returned as an array, and the list of events are sorted by
their priority.

@param null|string $eventName

@return array

@internal