class Event

Methods

__construct(string $name)

Event constructor.

addListener(string|callable $handler)

Adds a listener to the event.

setListener(string|callable $handler)

Sets a single listener for the event, replacing any existing listeners.

dispatch(mixed ...$arguments)

Dispatches the event to all registered listeners.

Details

at line 12
__construct(string $name)

Event constructor.

Parameters

string $name

The name of the event.

at line 20
addListener(string|callable $handler)

Adds a listener to the event.

Parameters

string|callable $handler

The handler for the event. If a string is provided, it will be processed by remove_spaces.

at line 33
setListener(string|callable $handler)

Sets a single listener for the event, replacing any existing listeners.

Parameters

string|callable $handler

The handler for the event. If a string is provided, it will be processed by remove_spaces.

at line 45
dispatch(mixed ...$arguments)

Dispatches the event to all registered listeners.

Parameters

mixed ...$arguments

The arguments to pass to the listeners.