Ciconia / A New Markdown Parser for #PHP

trait EmitterTrait

Central event manager (heavily inspired by Node.js's EventEmitter)

Methods

EmitterInterface on(string $event, callable $callback, int $priority = 10)

Adds a listener to the end of the listeners array for the specified event.

emit(string $event, array $parameters)

Execute each of the subscribed listeners

Details

at line 27 public EmitterInterface on(string $event, callable $callback, int $priority = 10)

Adds a listener to the end of the listeners array for the specified event.

Parameters

string $event The name of the event
callable $callback The callback
int $priority The lower this value, the earlier an event listener will be emitted.

Return Value

EmitterInterface

at line 45 public emit(string $event, array $parameters)

Execute each of the subscribed listeners

Parameters

string $event The name of the event to emit
array $parameters The arguments