GenericEvent
extends Event
in package
implements
ArrayAccess, IteratorAggregate
Event encapsulation class.
Encapsulates events thus decoupling the observer from the subject they encapsulate.
Tags
Table of Contents
Interfaces
- ArrayAccess
- IteratorAggregate
Properties
- $arguments : array<string|int, mixed>
- $subject : mixed
Methods
- __construct() : mixed
- Encapsulate an event with $subject and $arguments.
- getArgument() : mixed
- Get argument by key.
- getArguments() : array<string|int, mixed>
- Getter for all arguments.
- getIterator() : ArrayIterator<string, mixed>
- IteratorAggregate for iterating over the object like an array.
- getSubject() : mixed
- Getter for subject property.
- hasArgument() : bool
- Has argument.
- isPropagationStopped() : bool
- Is propagation stopped?
- offsetExists() : bool
- ArrayAccess has argument.
- offsetGet() : mixed
- ArrayAccess for argument getter.
- offsetSet() : void
- ArrayAccess for argument setter.
- offsetUnset() : void
- ArrayAccess for unset argument.
- setArgument() : $this
- Add argument to event.
- setArguments() : $this
- Set args property.
- stopPropagation() : void
- Stops the propagation of the event to further event listeners.
Properties
$arguments
protected
array<string|int, mixed>
$arguments
= []
$subject
protected
mixed
$subject
= null
Methods
__construct()
Encapsulate an event with $subject and $arguments.
public
__construct([mixed $subject = null ][, array<string|int, mixed> $arguments = [] ]) : mixed
Parameters
- $subject : mixed = null
-
The subject of the event, usually an object or a callable
- $arguments : array<string|int, mixed> = []
-
Arguments to store in the event
getArgument()
Get argument by key.
public
getArgument(string $key) : mixed
Parameters
- $key : string
Tags
getArguments()
Getter for all arguments.
public
getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed>getIterator()
IteratorAggregate for iterating over the object like an array.
public
getIterator() : ArrayIterator<string, mixed>
Return values
ArrayIterator<string, mixed>getSubject()
Getter for subject property.
public
getSubject() : mixed
hasArgument()
Has argument.
public
hasArgument(string $key) : bool
Parameters
- $key : string
Return values
boolisPropagationStopped()
Is propagation stopped?
public
isPropagationStopped() : bool
This will typically only be used by the Dispatcher to determine if the previous listener halted propagation.
Return values
bool —True if the Event is complete and no further listeners should be called. False to continue calling listeners.
offsetExists()
ArrayAccess has argument.
public
offsetExists(string $key) : bool
Parameters
- $key : string
-
Array key
Return values
booloffsetGet()
ArrayAccess for argument getter.
public
offsetGet(string $key) : mixed
Parameters
- $key : string
-
Array key
Tags
offsetSet()
ArrayAccess for argument setter.
public
offsetSet(string $key, mixed $value) : void
Parameters
- $key : string
-
Array key to set
- $value : mixed
offsetUnset()
ArrayAccess for unset argument.
public
offsetUnset(string $key) : void
Parameters
- $key : string
-
Array key
setArgument()
Add argument to event.
public
setArgument(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$thissetArguments()
Set args property.
public
setArguments([array<string|int, mixed> $args = [] ]) : $this
Parameters
- $args : array<string|int, mixed> = []
Return values
$thisstopPropagation()
Stops the propagation of the event to further event listeners.
public
stopPropagation() : void
If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().