PHP Class Symfony\Component\EventDispatcher\EventDispatcher

Listeners are registered on the manager and events are dispatched through the manager.
Author: Guilherme Blanco ([email protected])
Author: Jonathan Wage ([email protected])
Author: Roman Borschel ([email protected])
Author: Bernhard Schussek ([email protected])
Author: Fabien Potencier ([email protected])
Author: Jordi Boggiano ([email protected])
Author: Jordan Alliot ([email protected])
Inheritance: implements Symfony\Component\EventDispatcher\EventDispatcherInterface
Exibir arquivo Open project: pmjones/php-framework-benchmarks Class Usage Examples

Public Methods

Method Description
addListener ( $eventName, $listener, $priority )
addSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )
connect ( string $name, mixed $listener, integer $priority ) Connects a listener to a given event name.
disconnect ( string $name ) Disconnects all listeners for the given event name.
dispatch ( $eventName, Symfony\Component\EventDispatcher\Event $event = null )
filter ( Symfony\Component\EventDispatcher\Event $event, mixed $value ) : Symfony\Component\EventDispatcher\Event Filters a value by calling all listeners of a given event.
getListeners ( $eventName = null )
getListeners ( string $name ) : array Returns all listeners associated with a given event name.
hasListeners ( $eventName = null )
hasListeners ( string $name ) : boolean Returns true if the given event name has some listeners.
notify ( Symfony\Component\EventDispatcher\Event $event ) : Symfony\Component\EventDispatcher\Event Notifies all listeners of a given event.
notifyUntil ( Symfony\Component\EventDispatcher\Event $event ) : Symfony\Component\EventDispatcher\Event Notifies all listeners of a given event until one returns a non null value.
removeListener ( $eventName, $listener )
removeSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )

Protected Methods

Method Description
doDispatch ( array[callback] $listeners, string $eventName, Symfony\Component\EventDispatcher\Event $event ) Triggers the listeners of an event.

Private Methods

Method Description
sortListeners ( string $eventName ) Sorts the internal list of listeners for the given event by priority.

Method Details

addListener() public method

See also: EventDispatcherInterface::addListener
public addListener ( $eventName, $listener, $priority )

addSubscriber() public method

See also: EventDispatcherInterface::addSubscriber
public addSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )
$subscriber Symfony\Component\EventDispatcher\EventSubscriberInterface

connect() public method

Connects a listener to a given event name.
public connect ( string $name, mixed $listener, integer $priority )
$name string An event name
$listener mixed A PHP callable
$priority integer The priority (between -10 and 10 -- defaults to 0)

disconnect() public method

Disconnects all listeners for the given event name.
public disconnect ( string $name )
$name string An event name

dispatch() public method

See also: EventDispatcherInterface::dispatch
public dispatch ( $eventName, Symfony\Component\EventDispatcher\Event $event = null )
$event Symfony\Component\EventDispatcher\Event

doDispatch() protected method

This method can be overridden to add functionality that is executed for each listener.
protected doDispatch ( array[callback] $listeners, string $eventName, Symfony\Component\EventDispatcher\Event $event )
$listeners array[callback]
$eventName string The name of the event to dispatch.
$event Symfony\Component\EventDispatcher\Event The event object to pass to the event handlers/listeners.

filter() public method

Filters a value by calling all listeners of a given event.
public filter ( Symfony\Component\EventDispatcher\Event $event, mixed $value ) : Symfony\Component\EventDispatcher\Event
$event Symfony\Component\EventDispatcher\Event An Event instance
$value mixed The value to be filtered
return Symfony\Component\EventDispatcher\Event The Event instance

getListeners() public method

See also: EventDispatcherInterface::getListeners
public getListeners ( $eventName = null )

getListeners() public method

Returns all listeners associated with a given event name.
public getListeners ( string $name ) : array
$name string The event name
return array An array of listeners

hasListeners() public method

See also: EventDispatcherInterface::hasListeners
public hasListeners ( $eventName = null )

hasListeners() public method

Returns true if the given event name has some listeners.
public hasListeners ( string $name ) : boolean
$name string The event name
return boolean true if some listeners are connected, false otherwise

notify() public method

Notifies all listeners of a given event.
public notify ( Symfony\Component\EventDispatcher\Event $event ) : Symfony\Component\EventDispatcher\Event
$event Symfony\Component\EventDispatcher\Event An Event instance
return Symfony\Component\EventDispatcher\Event The Event instance

notifyUntil() public method

Notifies all listeners of a given event until one returns a non null value.
public notifyUntil ( Symfony\Component\EventDispatcher\Event $event ) : Symfony\Component\EventDispatcher\Event
$event Symfony\Component\EventDispatcher\Event An Event instance
return Symfony\Component\EventDispatcher\Event The Event instance

removeListener() public method

See also: EventDispatcherInterface::removeListener
public removeListener ( $eventName, $listener )

removeSubscriber() public method

See also: EventDispatcherInterface::removeSubscriber
public removeSubscriber ( Symfony\Component\EventDispatcher\EventSubscriberInterface $subscriber )
$subscriber Symfony\Component\EventDispatcher\EventSubscriberInterface