Event.php
public static function dispatch(string $event, array $args = [], bool $return = false)
    {
        // is there some registered $listeners ?
        if (isset(Event::$listeners[$event]) && count(Event::$listeners[$event]) > 0) {

            // Get all listeners for given event.
            $listeners = Event::$listeners[$event];

            // Sort by priority
            krsort($listeners);

            // Loop through $listeners array
            foreach ($listeners as $listener) {

                // Loop through $_listener array
                foreach ($listener as $_listener) {

                    // Return or Render specific $_listener results ?
                    if ($return) {
                        return call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    } else {
                        call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    }
                }
            }
        }
    }
public static function dispatch(string $event, array $args = [], bool $return = false)
    {
        // is there some registered $listeners ?
        if (isset(Event::$listeners[$event]) && count(Event::$listeners[$event]) > 0) {

            // Get all listeners for given event.
            $listeners = Event::$listeners[$event];

            // Sort by priority
            krsort($listeners);

            // Loop through $listeners array
            foreach ($listeners as $listener) {

                // Loop through $_listener array
                foreach ($listener as $_listener) {

                    // Return or Render specific $_listener results ?
                    if ($return) {
                        return call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    } else {
                        call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    }
                }
            }
        }
    }
public static function dispatch ( string $ event , array $ args = [ ] , bool $ return = false ) { // is there some registered $listeners ? if ( isset ( Event :: $ listeners [ $ event ] ) && count ( Event :: $ listeners [ $ event ] ) > 0 ) { // Get all listeners for given event. $ listeners = Event :: $ listeners [ $ event ] ; // Sort by priority krsort ( $ listeners ) ; // Loop through $listeners array foreach ( $ listeners as $ listener ) { // Loop through $_listener array foreach ( $ listener as $ _listener ) { // Return or Render specific $_listener results ? if ( $ return ) { return call_user_func_array ( $ _listener [ 'function' ] , ( isset ( $ args ) ? $ args : $ _listener [ 'args' ] ) ) ; } else { call_user_func_array ( $ _listener [ 'function' ] , ( isset ( $ args ) ? $ args : $ _listener [ 'args' ] ) ) ; } } } } }
Dispatch all listeners of the given event.

Event::dispatch('event_name');

@access public
@param  string  $event       Event name
@param  array   $args        Arguments
@param  bool    $return      Return data or not. Default is false
@return mixed
Dispatch all listeners of the given event .