\LiftKit\Application\HookAction

Defines an Action hook.

An action hook passes the result of each action to the subsequent one, allowing for a sequential transformation from one value to another. Because of this, the callbacks associated with action hooks must accept one parameter, perform any transformation to be made to the parameter, and return its transformed result.

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(mixed  $value, mixed  $precedence = null) : mixed

Invokes all hooks of a given precedence for a given event.

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

Parameters

mixed $value

The value to be transformed.

mixed $precedence

(default: null) If provided, only callbacks of this precedence will be executed.

Returns

mixed