src/Application/Hook/Event.php
public function trigger ($args = array(), $precedence = null)
		{
			if (is_null($precedence)) {
				$functions = array();
				ksort($this->hooks);

				foreach ($this->hooks as $function_set) {
					foreach ($function_set as $function) {
						$functions[] = $function;
					}
				}

				$return = array();

				foreach ($functions as $function) {
					$return[] = call_user_func_array($function, $args);
				}

				return $return;

			} else {
				$return = array();

				if (isset($this->hooks[$precedence]) && is_array($this->hooks[$precedence])) {
					foreach ($this->hooks[$precedence] as $function) {
						$return[] = call_user_func_array($function, $args);
					}
				}

				return $return;
			}
		}
public function trigger ($args = array(), $precedence = null)
		{
			if (is_null($precedence)) {
				$functions = array();
				ksort($this->hooks);

				foreach ($this->hooks as $function_set) {
					foreach ($function_set as $function) {
						$functions[] = $function;
					}
				}

				$return = array();

				foreach ($functions as $function) {
					$return[] = call_user_func_array($function, $args);
				}

				return $return;

			} else {
				$return = array();

				if (isset($this->hooks[$precedence]) && is_array($this->hooks[$precedence])) {
					foreach ($this->hooks[$precedence] as $function) {
						$return[] = call_user_func_array($function, $args);
					}
				}

				return $return;
			}
		}
public function trigger ( $ args = array ( ) , $ precedence = null ) { if ( is_null ( $ precedence ) ) { $ functions = array ( ) ; ksort ( $ this -> hooks ) ; foreach ( $ this -> hooks as $ function_set ) { foreach ( $ function_set as $ function ) { $ functions [ ] = $ function ; } } $ return = array ( ) ; foreach ( $ functions as $ function ) { $ return [ ] = call_user_func_array ( $ function , $ args ) ; } return $ return ; } else { $ return = array ( ) ; if ( isset ( $ this -> hooks [ $ precedence ] ) && is_array ( $ this -> hooks [ $ precedence ] ) ) { foreach ( $ this -> hooks [ $ precedence ] as $ function ) { $ return [ ] = call_user_func_array ( $ function , $ args ) ; } } return $ return ; } }
Invokes all callback attached to the event

If null precedence is provided, invokes all hooks for a given event, regardless of precedence.

@api

@param array $args                       An array of parameters to be passed to each hook.
@param mixed $precedence (default: null) If provided, this hook will only execute the callbacks of the supplied precedence.

@return array
Invokes all callback attached to the event