\LiftKit\Application\HookEvent

Defines an Event hook

This class defines a type of hook that simply triggers each callback sequentially. The callbacks can accept an arbitrary number of arguments, but they must match each other's signature. The result of each callback is return in an array

Summary

Methods
Properties
Constants
bind()
release()
trigger()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

bind()

bind(callable  $function, integer  $precedence) : void

Assigns new hook for a given action

Optional precedence may be assigned.

Parameters

callable $function
integer $precedence

(default: 0)

release()

release(mixed  $precedence = null) : void

Releases callbacks which have already been bound

May be done for all callbacks, individual precedence levels for an given hook.

Parameters

mixed $precedence

(default: null) If supplied, will only the callbacks for a given precedence.

trigger()

trigger(array  $args = array(), mixed  $precedence = null) : array

Invokes all callback attached to the event

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

Parameters

array $args

An array of parameters to be passed to each hook.

mixed $precedence

(default: null) If provided, this hook will only execute the callbacks of the supplied precedence.

Returns

array