class GenericEvent extends Event implements ArrayAccess, IteratorAggregate

Event encapsulation class.

Encapsulates events thus decoupling the observer from the subject they encapsulate.

Properties

protected $subject
protected $arguments

Methods

bool
isPropagationStopped()

Returns whether further event listeners should be triggered.

from Event
stopPropagation()

Stops the propagation of the event to further event listeners.

from Event
setDispatcher(EventDispatcherInterface $dispatcher) deprecated

Stores the EventDispatcher that dispatches this Event.

from Event
getDispatcher() deprecated

Returns the EventDispatcher that dispatches this Event.

from Event
string
getName() deprecated

Gets the event's name.

from Event
setName(string $name) deprecated

Sets the event's name property.

from Event
__construct(mixed $subject = null, array $arguments = array())

Encapsulate an event with $subject and $args.

mixed
getSubject()

Getter for subject property.

mixed
getArgument(string $key)

Get argument by key.

$this
setArgument(string $key, mixed $value)

Add argument to event.

array
getArguments()

Getter for all arguments.

$this
setArguments(array $args = array())

Set args property.

bool
hasArgument(string $key)

Has argument.

mixed
offsetGet(string $key)

ArrayAccess for argument getter.

offsetSet(string $key, mixed $value)

ArrayAccess for argument setter.

offsetUnset(string $key)

ArrayAccess for unset argument.

bool
offsetExists(string $key)

ArrayAccess has argument.

getIterator()

IteratorAggregate for iterating over the object like an array.

Details

in Event at line 52
bool isPropagationStopped()

Returns whether further event listeners should be triggered.

Return Value

bool Whether propagation was already stopped for this event

See also

in Event at line 64
stopPropagation()

Stops the propagation of the event to further event listeners.

If multiple event listeners are connected to the same event, no further event listener will be triggered once any trigger calls stopPropagation().

in Event at line 76
setDispatcher(EventDispatcherInterface $dispatcher) deprecated

deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.

Stores the EventDispatcher that dispatches this Event.

Parameters

EventDispatcherInterface $dispatcher

in Event at line 88
EventDispatcherInterface getDispatcher() deprecated

deprecated since version 2.4, to be removed in 3.0. The event dispatcher is passed to the listener call.

Returns the EventDispatcher that dispatches this Event.

in Event at line 102
string getName() deprecated

deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.

Gets the event's name.

Return Value

string

in Event at line 116
setName(string $name) deprecated

deprecated since version 2.4, to be removed in 3.0. The event name is passed to the listener call.

Sets the event's name property.

Parameters

string $name The event name

at line 32
__construct(mixed $subject = null, array $arguments = array())

Encapsulate an event with $subject and $args.

Parameters

mixed $subject The subject of the event, usually an object or a callable
array $arguments Arguments to store in the event

at line 43
mixed getSubject()

Getter for subject property.

Return Value

mixed The observer subject

at line 57
mixed getArgument(string $key)

Get argument by key.

Parameters

string $key Key

Return Value

mixed Contents of array key

Exceptions

InvalidArgumentException if key is not found

at line 74
$this setArgument(string $key, mixed $value)

Add argument to event.

Parameters

string $key Argument name
mixed $value Value

Return Value

$this

at line 86
array getArguments()

Getter for all arguments.

Return Value

array

at line 98
$this setArguments(array $args = array())

Set args property.

Parameters

array $args Arguments

Return Value

$this

at line 112
bool hasArgument(string $key)

Has argument.

Parameters

string $key Key of arguments array

Return Value

bool

at line 126
mixed offsetGet(string $key)

ArrayAccess for argument getter.

Parameters

string $key Array key

Return Value

mixed

Exceptions

InvalidArgumentException if key does not exist in $this->args

at line 137
offsetSet(string $key, mixed $value)

ArrayAccess for argument setter.

Parameters

string $key Array key to set
mixed $value Value

at line 147
offsetUnset(string $key)

ArrayAccess for unset argument.

Parameters

string $key Array key

at line 161
bool offsetExists(string $key)

ArrayAccess has argument.

Parameters

string $key Array key

Return Value

bool

at line 171
ArrayIterator getIterator()

IteratorAggregate for iterating over the object like an array.

Return Value

ArrayIterator