Event
class Event
Event listener.
Properties
protected Container | $container | Container. | |
protected array | $events | Registered event listeners. |
Methods
Returns TRUE if an event listener is registered for the event and FALSE if not.
Returns an array of all registered events.
Clears all events handlers for the specified event.
Executes a closure handler and returns the response.
Resolves a class handler.
Executes a class handler and returns the response.
Executes the event handler and returns the response.
Runs all closures for an event and returns an array contaning the return values of each event handler.
Details
at line 39
__construct(Container|null $container = null)
Constructor.
at line 50
register(string $name, Closure|string $handler)
Registers an event handler.
at line 61
bool
has(string $name)
Returns TRUE if an event listener is registered for the event and FALSE if not.
at line 71
array
events()
Returns an array of all registered events.
at line 81
clear(string $name)
Clears all events handlers for the specified event.
at line 92
override(string $name, Closure|string $handler)
Overrides an event.
at line 106
protected mixed
executeClosureHandler(Closure $handler, array $parameters)
Executes a closure handler and returns the response.
at line 117
protected EventHandlerInterface
resolveHandler(string $handler)
Resolves a class handler.
at line 129
protected mixed
executeClassHandler(EventHandlerInterface $handler, array $parameters)
Executes a class handler and returns the response.
at line 141
protected mixed
executeHandler(Closure|string $handler, array $parameters)
Executes the event handler and returns the response.
at line 162
array
trigger(string $name, array $parameters = [], bool $break = false)
Runs all closures for an event and returns an array contaning the return values of each event handler.