\LiftKit\ApplicationApplication

Container for encapsulating, binding, and triggering hooks.

Summary

Methods
Properties
Constants
registerHook()
bindHook()
triggerHook()
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

registerHook()

registerHook(string  $key, \LiftKit\Application\Hook\Hook  $hook) 

Registers a hook with the application for future interactions.

Parameters

string $key

String identifier for hook used in subsequent calls to bindHook() and triggerHook().

\LiftKit\Application\Hook\Hook $hook

The hook to be registered.

Throws

\LiftKit\Application\Exception\InvalidHookIdentifier
\LiftKit\Application\Exception\ReregisterHook

bindHook()

bindHook(string  $key, callable  $closure, integer  $precedence) 

Binds an action to be taken when a hook is triggered. The hook must be registered before it can be bound to an action.

Parameters

string $key

String identifier of registered hook.

callable $closure

A closure representing the action to be taken when the hook is triggered.

integer $precedence

Determines the order that the actions will occur in when the hook is triggered, lowest first.

Throws

\LiftKit\Application\Exception\UnregisteredHook

triggerHook()

triggerHook(string  $key, array  $args = array(), null  $precedence = null) : mixed

Will sequentially call each action bound to the hook. The hook must be registered before it can be bound to an action.

The format of the result of this call as well as the behavior from call to call varies by the type of hook.

Parameters

string $key

String identifier of registered hook.

array $args

Arguments which will be passed to each callback.

null $precedence

If supplied, the hook's actions will only be executed for a given precedence.

Throws

\LiftKit\Application\Exception\UnregisteredHook

Returns

mixed