AbstractEvent
in package
Represents a class-based event.
Tags
Table of Contents
Methods
- description() : string
- Get the description of the event.
- dispatch() : array<string|int, mixed>|null
- Helper method to dispatch an event, equivalent to ```php EventHandler::executeEvent(new EventClass(...)); ```.
- fromArray() : AbstractEvent
- Create an instance of the event from an array of parameters.
- internal() : bool
- Determine whether to hide this hook from users in the StaffCP, some events should be private.
- name() : string
- Convert the class name to the event name.
- params() : array<string|int, mixed>
- Get the parameters of the event.
- return() : bool
- Determine whether to return the response after executing the event.
Methods
description()
Get the description of the event.
public
abstract static description() : string
Return values
string —The description of the event
dispatch()
Helper method to dispatch an event, equivalent to ```php EventHandler::executeEvent(new EventClass(...)); ```.
public
final static dispatch() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —The response from the event, or null if the event is not returning a response
fromArray()
Create an instance of the event from an array of parameters.
public
final static fromArray(array<string|int, mixed> $params) : AbstractEvent
Parameters
- $params : array<string|int, mixed>
-
The parameters to pass to the event
Return values
AbstractEvent —The event instance
internal()
Determine whether to hide this hook from users in the StaffCP, some events should be private.
public
static internal() : bool
Return values
bool —Whether to hide this hook from users in the StaffCP
name()
Convert the class name to the event name.
public
static name() : string
Example: UserDeletedEvent -> userDeleted.
Return values
string —The name of the subclass, without the "Event" suffix
params()
Get the parameters of the event.
public
final params() : array<string|int, mixed>
Parameters are assumed to be public properties of the event class.
Return values
array<string|int, mixed> —The parameters of the event
return()
Determine whether to return the response after executing the event.
public
static return() : bool
Return values
bool —Whether to return the response after executing the event