ICanBoogie
  • Documentation
  • API Reference
  • Event master
Namespaces
  • ICanBoogie
Classes
  • Event
  • EventCollection
  • EventCollectionProvider
  • EventHook
  • EventHookReflection
  • EventProfiler
  • EventReflection

Class Event

An event.

ICanBoogie\Event uses ICanBoogie\Accessor\AccessorTrait (not available)
Namespace: ICanBoogie
Located at Event.php

Methods summary

public static from( array $params ) : ICanBoogie\Event

Returns an unfired, initialized event.

Returns an unfired, initialized event.

Parameters

$params

Returns

ICanBoogie\Event

See

EventReflection::from
protected get_stopped( void )
protected get_used_by( void )
protected get_used( void )
protected get_target( void )
public __construct( mixed $target, string $type, array $payload = [] )

Creates an event and fires it immediately.

Creates an event and fires it immediately.

If the event's target is specified its class is used to prefix the event type. For example, if the event's target is an instance of ICanBoogie\Operation and the event type is process the final event type will be ICanBoogie\Operation::process.

Parameters

$target
The target of the event.
$type
The event type.
$payload
Event payload.

Throws

PropertyIsReserved
in attempt to specify a reserved property with the payload.
public fire( void )

Fires the event.

Fires the event.

public stop( void )

Stops the hooks chain.

Stops the hooks chain.

After the stop() method is called the hooks chain is broken and no other hook is called.

public chain( callable $hook ) : ICanBoogie\Event

Add an event hook to the finish chain.

Add an event hook to the finish chain.

The finish chain is executed after the event chain was traversed without being stopped.

Parameters

$hook

Returns

ICanBoogie\Event

Properties summary

Magic properties

public read-only $stopped

bool true when the event was stopped, false otherwise.

public read-only $used

int The number of event hooks that were invoked while dispatching the event.

public read-only $used_by

array Event hooks that were invoked while dispatching the event.

public read-only $target

mixed The object the event is dispatched on.

Event master – Check on GitHub – API documentation generated by ApiGen