Class SignalHandler
Assist on the management of signals send at a global scope thru the whole
system.
Methods summary
public static
|
#
Send( string $signal_type, Peg\Lib\Signals\SignalData & $signal_data = null )
Calls all callbacks listening for a given signal type. The $var1-$var6 are
optional parameters passed to the callback.
Calls all callbacks listening for a given signal type. The $var1-$var6 are
optional parameters passed to the callback.
Parameters
|
public static
|
#
Listen( string $signal_type, function $callback, integer $priority = 10 )
Add a callback that listens to a specific signal.
Add a callback that listens to a specific signal.
Parameters
- $signal_type
string $signal_type
- $callback
function $callback
- $priority
integer $priority
|
public static
|
#
Unlisten( string $signal_type, function $callback )
Remove a callback from listening a given signal type.
Remove a callback from listening a given signal type.
Parameters
- $signal_type
string $signal_type
- $callback
function $callback
|
public static
array
|
#
Sort( array $data_array, string $field_name, mixed $sort_method = SORT_ASC )
Sorts an array of listener function using bubble sort.
Sorts an array of listener function using bubble sort.
Parameters
- $data_array
array $data_array The array to sort in the format returned by data_parser().
- $field_name
string $field_name The field we are using to sort the array by.
- $sort_method
mixed $sort_method The type of sorting, default is ascending.
Returns
array The same array but sorted by the given field name.
|