Class Symfony\Component\EventDispatcher\GenericEvent

InheritanceSymfony\Component\EventDispatcher\GenericEvent » Symfony\Component\EventDispatcher\Event
ImplementsArrayAccess, IteratorAggregate

Event encapsulation class.

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

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$arguments array Symfony\Component\EventDispatcher\GenericEvent
$subject mixed Usually object or callable Symfony\Component\EventDispatcher\GenericEvent

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Encapsulate an event with $subject and $args. Symfony\Component\EventDispatcher\GenericEvent
getArgument() Get argument by key. Symfony\Component\EventDispatcher\GenericEvent
getArguments() Getter for all arguments. Symfony\Component\EventDispatcher\GenericEvent
getDispatcher() Returns the EventDispatcher that dispatches this Event. Symfony\Component\EventDispatcher\Event
getIterator() IteratorAggregate for iterating over the object like an array. Symfony\Component\EventDispatcher\GenericEvent
getName() Gets the event's name. Symfony\Component\EventDispatcher\Event
getSubject() Getter for subject property. Symfony\Component\EventDispatcher\GenericEvent
hasArgument() Has argument. Symfony\Component\EventDispatcher\GenericEvent
isPropagationStopped() Returns whether further event listeners should be triggered. Symfony\Component\EventDispatcher\Event
offsetExists() ArrayAccess has argument. Symfony\Component\EventDispatcher\GenericEvent
offsetGet() ArrayAccess for argument getter. Symfony\Component\EventDispatcher\GenericEvent
offsetSet() ArrayAccess for argument setter. Symfony\Component\EventDispatcher\GenericEvent
offsetUnset() ArrayAccess for unset argument. Symfony\Component\EventDispatcher\GenericEvent
setArgument() Add argument to event. Symfony\Component\EventDispatcher\GenericEvent
setArguments() Set args property. Symfony\Component\EventDispatcher\GenericEvent
setDispatcher() Stores the EventDispatcher that dispatches this Event. Symfony\Component\EventDispatcher\Event
setName() Sets the event's name property. Symfony\Component\EventDispatcher\Event
stopPropagation() Stops the propagation of the event to further event listeners. Symfony\Component\EventDispatcher\Event

Property Details

$arguments protected property
protected array $arguments null
$subject protected property

Usually object or callable

protected mixed $subject null

Method Details

__construct() public method

Encapsulate an event with $subject and $args.

public void __construct ( $subject null, array $arguments = [] )
$subject mixed

The subject of the event, usually an object

$arguments array

Arguments to store in the event

getArgument() public method

Get argument by key.

public mixed getArgument ( $key )
$key string

Key

return mixed

Contents of array key

throws InvalidArgumentException

If key is not found.

getArguments() public method

Getter for all arguments.

public array getArguments ( )
getIterator() public method

IteratorAggregate for iterating over the object like an array.

public ArrayIterator getIterator ( )
getSubject() public method

Getter for subject property.

public mixed getSubject ( )
return mixed

$subject The observer subject

hasArgument() public method

Has argument.

public bool hasArgument ( $key )
$key string

Key of arguments array

offsetExists() public method

ArrayAccess has argument.

public bool offsetExists ( $key )
$key string

Array key

offsetGet() public method

ArrayAccess for argument getter.

public mixed offsetGet ( $key )
$key string

Array key

throws InvalidArgumentException

If key does not exist in $this->args.

offsetSet() public method

ArrayAccess for argument setter.

public void offsetSet ( $key, $value )
$key string

Array key to set

$value mixed

Value

offsetUnset() public method

ArrayAccess for unset argument.

public void offsetUnset ( $key )
$key string

Array key

setArgument() public method

Add argument to event.

public Symfony\Component\EventDispatcher\GenericEvent setArgument ( $key, $value )
$key string

Argument name

$value mixed

Value

setArguments() public method

Set args property.

public Symfony\Component\EventDispatcher\GenericEvent setArguments ( array $args = [] )
$args array

Arguments