public static function callUserFuncArray($callback, $args = []) {
        // Figure out the event name from the callback.
        $event_name = static::getEventname($callback);
        if (!$event_name) {
            return call_user_func_array($callback, $args);
        }

        // The events could have different args because the event handler can take the object as the first parameter.
        $event_args = $args;
        // If the callback is an object then it gets passed as the first argument.
        if (is_array($callback) && is_object($callback[0])) {
            array_unshift($event_args, $callback[0]);
        }

        // Fire before events.
        self::fireArray($event_name.'_before', $event_args);

        // Call the function.
        if (static::hasHandler($event_name)) {
            // The callback was overridden so fire it.
            $result = static::fireArray($event_name, $event_args);
        } else {
            // The callback was not overridden so just call the passed callback.
            $result = call_user_func_array($callback, $args);
        }

        // Fire after events.
        self::fireArray($event_name.'_after', $event_args);

        return $result;
    }
public static function callUserFuncArray($callback, $args = []) {
        // Figure out the event name from the callback.
        $event_name = static::getEventname($callback);
        if (!$event_name) {
            return call_user_func_array($callback, $args);
        }

        // The events could have different args because the event handler can take the object as the first parameter.
        $event_args = $args;
        // If the callback is an object then it gets passed as the first argument.
        if (is_array($callback) && is_object($callback[0])) {
            array_unshift($event_args, $callback[0]);
        }

        // Fire before events.
        self::fireArray($event_name.'_before', $event_args);

        // Call the function.
        if (static::hasHandler($event_name)) {
            // The callback was overridden so fire it.
            $result = static::fireArray($event_name, $event_args);
        } else {
            // The callback was not overridden so just call the passed callback.
            $result = call_user_func_array($callback, $args);
        }

        // Fire after events.
        self::fireArray($event_name.'_after', $event_args);

        return $result;
    }
public static function callUserFuncArray ( $ callback , $ args = [ ] ) { // Figure out the event name from the callback. $ event_name = static :: getEventname ( $ callback ) ; if ( ! $ event_name ) { return call_user_func_array ( $ callback , $ args ) ; } // The events could have different args because the event handler can take the object as the first parameter. $ event_args = $ args ; // If the callback is an object then it gets passed as the first argument. if ( is_array ( $ callback ) && is_object ( $ callback [ 0 ] ) ) { array_unshift ( $ event_args , $ callback [ 0 ] ) ; } // Fire before events. self :: fireArray ( $ event_name . '_before' , $ event_args ) ; // Call the function. if ( static :: hasHandler ( $ event_name ) ) { // The callback was overridden so fire it. $ result = static :: fireArray ( $ event_name , $ event_args ) ; } else { // The callback was not overridden so just call the passed callback. $ result = call_user_func_array ( $ callback , $ args ) ; } // Fire after events. self :: fireArray ( $ event_name . '_after' , $ event_args ) ; return $ result ; }
Call a callback with an array of parameters, checking for events to be called with the callback.

This method is similar to {@link call_user_func_array()} but it will fire events that can happen
before and/or after the callback and can call an event instead of the callback itself to override it.

In order to use events with this method they must be bound with a particular naming convention.

**Modify a function**

- functionname_before
- functionname
- functionname_after

**Modify a method call**

- classname_methodname_before
- classname_methodname
- classname_methodname_after

@param callable $callback The {@link callable} to be called.
@param array $args The arguments to be passed to the callback, as an indexed array.
@return mixed Returns the return value of the callback.
Call a callback with an array of parameters checking for events to be called with the callback .