extends |
BaseEvent |
|---|---|
implements |
GenericEventInterface |
uses |
GenericEventTrait |
A generic event used to collect data.
This class implements f3-event-dispatcher's GenericEventInterface, and
therefore the event name is specified by the $eventName parameter
passed in the constructor.
Listeners add data by calling the addResult() method. How this is added to the existing data depends on the merge strategy:
MERGE_APPEND, then the result
is appended to the existing dataMERGE_PLAIN, then the result
is merged to the existing data using array_merge
MERGE_RECURSIVE, then the result
is merged to the existing data using array_merge_recursive
MERGE_DEFAULT, then the result is
appended if it is a scalar, or merged if it is an arrayThe emitter can retrieve the collected data by calling the getResults() method.
| Methods | ||
|---|---|---|
public
|
__construct(string $eventName = null, int $mergeStrategy = self::MERGE_DEFAULT)
|
# |
public
|
addResult(mixed $result): void
|
# |
public
|
getResults(): array<mixed>
|
# |
public
|
hasResults(): bool
|
# |
protected
|
isEmpty(mixed $x): bool
|
# |
| Methods used from SimpleID\Util\Events\GenericEventTrait |
|---|
setEventName(), getEventName() |
| Constants | |||
|---|---|---|---|
public
|
MERGE_DEFAULT = 0
|
# | |
public
|
MERGE_APPEND = 1
|
# | |
public
|
MERGE_PLAIN = 2
|
# | |
public
|
MERGE_RECURSIVE = 3
|
# | |
public
|
MERGE_MERGE = self::MERGE_PLAIN
|
# | |
| Properties | |||
|---|---|---|---|
protected
|
array<mixed>
|
$results = []
|
# |
protected
|
int
|
$mergeStrategy
|
# |
| Properties used from SimpleID\Util\Events\GenericEventTrait |
|---|
$eventName |