public static
|
|
public static
ICanBoogie\EventCollection
|
#
get( )
Returns the singleton instance of the class.
Returns the singleton instance of the class.
Returns
|
public
|
#
__construct( array $definitions = [] )
Parameters
- $definitions
- Event hooks grouped by type.
|
public
|
#
getIterator( )
Returns an iterator for event hooks.
Returns an iterator for event hooks.
Implementation of
IteratorAggregate::getIterator()
|
protected
|
|
public
ICanBoogie\EventHook
|
#
attach( string $type, callable $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
- $type
- Event type or closure.
- $hook
- The event hook, or nothing if $type is a closure.
Returns
Throws
InvalidArgumentException when $hook is not a callable.
|
public
|
#
attach_many( array $definitions )
Attaches many event hooks grouped by event type.
Attaches many event hooks grouped by event type.
Parameters
|
public
ICanBoogie\EventHook
|
#
attach_to( object $target, callable $hook )
Attaches an event hook to a specific target.
Attaches an event hook to a specific target.
Parameters
Returns
|
public
ICanBoogie\EventHook
|
#
once( mixed $type, mixed $hook = null )
Attach an event hook that is detached once used.
Attach an event hook that is detached once used.
Parameters
Returns
See
|
public
|
#
detach( string $name, callable $hook )
Detaches an event hook.
Parameters
- $name
- The name of the event.
- $hook
- The event hook.
Throws
Exception when the event hook is not attached to the event name.
|
public
|
#
skip( string $name )
Marks an event as skippable.
Marks an event as skippable.
Parameters
|
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
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
Returns
array
|