protected function sortListeners($eventName)
    {
        // If listeners exist for the given event, we will sort them by the priority
        // so that we can call them in the correct order. We will cache off these
        // sorted event listeners so we do not have to re-sort on every events.
        $listeners = isset($this->listeners[$eventName])
                            ? $this->listeners[$eventName] : [];

        if (class_exists($eventName)) {
            foreach (class_implements($eventName) as $interface) {
                if (isset($this->listeners[$interface])) {
                    foreach ($this->listeners[$interface] as $priority => $names) {
                        if (isset($listeners[$priority])) {
                            $listeners[$priority] = array_merge($listeners[$priority], $names);
                        } else {
                            $listeners[$priority] = $names;
                        }
                    }
                }
            }
        }

        if ($listeners) {
            krsort($listeners);

            $this->sorted[$eventName] = call_user_func_array('array_merge', $listeners);
        } else {
            $this->sorted[$eventName] = [];
        }
    }
protected function sortListeners($eventName)
    {
        // If listeners exist for the given event, we will sort them by the priority
        // so that we can call them in the correct order. We will cache off these
        // sorted event listeners so we do not have to re-sort on every events.
        $listeners = isset($this->listeners[$eventName])
                            ? $this->listeners[$eventName] : [];

        if (class_exists($eventName)) {
            foreach (class_implements($eventName) as $interface) {
                if (isset($this->listeners[$interface])) {
                    foreach ($this->listeners[$interface] as $priority => $names) {
                        if (isset($listeners[$priority])) {
                            $listeners[$priority] = array_merge($listeners[$priority], $names);
                        } else {
                            $listeners[$priority] = $names;
                        }
                    }
                }
            }
        }

        if ($listeners) {
            krsort($listeners);

            $this->sorted[$eventName] = call_user_func_array('array_merge', $listeners);
        } else {
            $this->sorted[$eventName] = [];
        }
    }
protected function sortListeners ( $ eventName ) { // If listeners exist for the given event, we will sort them by the priority // so that we can call them in the correct order. We will cache off these // sorted event listeners so we do not have to re-sort on every events. $ listeners = isset ( $ this -> listeners [ $ eventName ] ) ? $ this -> listeners [ $ eventName ] : [ ] ; if ( class_exists ( $ eventName ) ) { foreach ( class_implements ( $ eventName ) as $ interface ) { if ( isset ( $ this -> listeners [ $ interface ] ) ) { foreach ( $ this -> listeners [ $ interface ] as $ priority => $ names ) { if ( isset ( $ listeners [ $ priority ] ) ) { $ listeners [ $ priority ] = array_merge ( $ listeners [ $ priority ] , $ names ) ; } else { $ listeners [ $ priority ] = $ names ; } } } } } if ( $ listeners ) { krsort ( $ listeners ) ; $ this -> sorted [ $ eventName ] = call_user_func_array ( 'array_merge' , $ listeners ) ; } else { $ this -> sorted [ $ eventName ] = [ ] ; } }
Sort the listeners for a given event by priority.

@param  string  $eventName
@return void
Sort the listeners for a given event by priority .