Chyrp

Trigger

Controls and keeps track of all of the Triggers and events.

Summary
Trigger Controls and keeps track of all of the Triggers and events.
Variables
$priorities Custom prioritized callbacks.
$called Keeps track of called Triggers.
$exists Caches trigger exist states.
Functions
cmp Sorts actions by priority when used with usort.
call Calls a trigger, passing any additional arguments to it.
filter Filters a variable through a trigger’s actions.  Similar to call, except this is stackable and is intended to modify something instead of inject code.
remove Unregisters a given $action from a $trigger.
exists Checks if there are any actions for a given $trigger.
current Returns a singleton reference to the current class.

Variables

$priorities

public $priorities

Custom prioritized callbacks.

$called

private $called

Keeps track of called Triggers.

$exists

private $exists

Caches trigger exist states.

Functions

cmp

function cmp( $a,
$b )

Sorts actions by priority when used with usort.

call

public function call( $name )

Calls a trigger, passing any additional arguments to it.

Parameters

$name The name of the trigger, or an array of triggers to call.

filter

public function filter( & $target,
$name )

Filters a variable through a trigger’s actions.  Similar to call, except this is stackable and is intended to modify something instead of inject code.

Any additional arguments passed to this function are passed to the function being called.

Parameters

$target The variable to filter.
$name The name of the trigger.

Returns

$target, filtered through any/all actions for the trigger $name.

remove

public function remove( $trigger,
$action )

Unregisters a given $action from a $trigger.

Parameters

$trigger The trigger to unregister from.
$action The action name.

exists

public function exists( $name )

Checks if there are any actions for a given $trigger.

Parameters

$trigger The trigger name.

Returns

true if there are actions for the trigger.

current

public static function & current()

Returns a singleton reference to the current class.