Class Events
Events collected from the "hooks" config or attached by the user.
-
ICanBoogie\Events
implements
IteratorAggregate
Methods summary
public static
mixed
|
#
__callstatic( string $name, array $arguments )
Calls the callback of a patchable function.
Calls the callback of a patchable function.
Parameters
- $name
string $name Name of the function.
- $arguments
array $arguments Arguments.
Returns
mixed
|
public static
|
#
patch( string $name, collable $callback )
Patches a patchable function.
Patches a patchable function.
Parameters
- $name
string $name Name of the function.
- $callback
collable $callback Callback.
Throws
|
public
|
|
public
|
#
getIterator( )
Returns an iterator for event hooks.
Returns an iterator for event hooks.
Implementation of
|
public
ICanBoogie\EventHook
|
#
attach( callable $name, mixed $hook = null )
Attaches an event hook.
The name of the event is resolved from the parameters of the event hook.
Consider the following code:
<?php
$events->attach(function(ICanBoogie\Operation\BeforeProcessEvent $event, ICanBoogie\SaveOperation $target) {
// …
});
The hook will be attached to the
ICanBoogie\SaveOperation::process:before event.
Parameters
- $name
callable $hook The event hook.
- $hook
Returns
Throws
|
public
|
|
public
|
#
detach( string $name, callable $hook )
Detaches an event hook.
Parameters
- $name
string $name The name of the event.
- $hook
callable $hook The event hook.
Throws
|
public
|
#
skip( string $name )
Marks an event as skippable.
Marks an event as skippable.
Parameters
- $name
string $name The event name.
|
public
boolean
|
#
is_skippable( string $name )
Returns whether or not an event has been marked as skippable.
Returns whether or not an event has been marked as skippable.
Parameters
- $name
string $name The event name.
Returns
boolean
true if the event can be skipped, false otherwise.
|
public
array
|
#
get_hooks( string $name )
Returns the event hooks attached to the specified event name.
Returns the event hooks attached to the specified event name.
If the class of the event's target is provided, event hooks are filtered
according to the class and its hierarchy.
Parameters
- $name
string $name The event name.
Returns
array
|
Magic methods summary
Properties summary
protected
array[string]array
|
$hooks
|
|
protected
array[string]array
|
$consolidated_hooks
|
#
Event hooks consolidated by class and type.
Event hooks consolidated by class and type.
|
protected
array[string]bool
|
$skippable
|
#
Lists of skippable events.
Lists of skippable events.
|