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;

    }
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;

    }
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 ; }
get all listeners registered for a given event name
if no event name is supplied this will return all registered
listeners grouped by event name and sorted by priority

@param null $eventName
@return array
get all listeners registered for a given event name if no event name is supplied this will return all registered listeners grouped by event name and sorted by priority