src/PubSub/Manager.php
public function getSubscribers($eventName = null)
    {
        if ($eventName !== null) {
            if (!isset($this->subscribers[$eventName])) {
                return array();
            }
            if (!isset($this->sorted[$eventName])) {
                $this->sortSubscribers($eventName);
            }
            return $this->sorted[$eventName];
        }
        // return all subscribers
        foreach (\array_keys($this->subscribers) as $eventName) {
            if (!isset($this->sorted[$eventName])) {
                $this->sortSubscribers($eventName);
            }
        }
        return \array_filter($this->sorted);
    }
public function getSubscribers($eventName = null)
    {
        if ($eventName !== null) {
            if (!isset($this->subscribers[$eventName])) {
                return array();
            }
            if (!isset($this->sorted[$eventName])) {
                $this->sortSubscribers($eventName);
            }
            return $this->sorted[$eventName];
        }
        // return all subscribers
        foreach (\array_keys($this->subscribers) as $eventName) {
            if (!isset($this->sorted[$eventName])) {
                $this->sortSubscribers($eventName);
            }
        }
        return \array_filter($this->sorted);
    }
Gets the subscribers of a specific event or all subscribers sorted by descending priority.

If event name is not specified, subscribers for all events will be returned

@param string $eventName The name of the event

@return array The event subscribers for the specified event, or all event subscribers by event name