EventInterface
in
Represents the transport class of events across the system. It receives a name, subject and an optional payload. The name can be any string that uniquely identifies the event across the application, while the subject represents the object that the event applies to.
Tags
Table of Contents
Methods
- getData() : mixed|array<string|int, mixed>|null
- Accesses the event data/payload.
- getName() : string
- Returns the name of this event. This is usually used as the event identifier.
- getResult() : mixed
- The result value of the event listeners.
- getSubject() : object
- Returns the subject of this event.
- isStopped() : bool
- Checks if the event is stopped.
- setData() : $this
- Assigns a value to the data/payload of this event.
- setResult() : $this
- Listeners can attach a result value to the event.
- stopPropagation() : void
- Stops the event from being used anymore.
Methods
getData()
Accesses the event data/payload.
public
getData([string|null $key = null ]) : mixed|array<string|int, mixed>|null
Parameters
- $key : string|null = null
-
The data payload element to return, or null to return all data.
Return values
mixed|array<string|int, mixed>|null —The data payload if $key is null, or the data value for the given $key. If the $key does not exist a null value is returned.
getName()
Returns the name of this event. This is usually used as the event identifier.
public
getName() : string
Return values
stringgetResult()
The result value of the event listeners.
public
getResult() : mixed
getSubject()
Returns the subject of this event.
public
getSubject() : object
Tags
Return values
objectisStopped()
Checks if the event is stopped.
public
isStopped() : bool
Return values
bool —True if the event is stopped
setData()
Assigns a value to the data/payload of this event.
public
setData(array<string|int, mixed>|string $key[, mixed $value = null ]) : $this
Parameters
- $key : array<string|int, mixed>|string
-
An array will replace all payload data, and a key will set just that array item.
- $value : mixed = null
-
The value to set.
Return values
$thissetResult()
Listeners can attach a result value to the event.
public
setResult([mixed $value = null ]) : $this
Parameters
- $value : mixed = null
-
The value to set.
Return values
$thisstopPropagation()
Stops the event from being used anymore.
public
stopPropagation() : void