PHP Class FOF30\Event\Dispatcher

Inheritance: implements FOF30\Event\Observable
Afficher le fichier Open project: akeeba/fof Class Usage Examples

Protected Properties

Свойство Type Description
$container The container this event dispatcher is attached to
$events Maps events to observers
$observers The observers attached to the dispatcher

Méthodes publiques

Méthode Description
__construct ( Container $container ) Public constructor
attach ( Observer $observer ) : Dispatcher Attaches an observer to the object
chainHandle ( string $event, array $args = [] ) : mixed Asks each observer to handle an event based on the provided arguments. The first observer to return a non-null result wins. This is a *very* simplistic implementation of the Chain of Command pattern.
detach ( Observer $observer ) : Dispatcher Detaches an observer from the object
getContainer ( ) : Container Returns the container this event dispatcher is attached to
getObserverByClass ( string $className ) : null | Observer Returns an observer attached to this behaviours dispatcher by its class name
hasObserver ( Observer $observer ) : boolean Is an observer object already registered with this dispatcher?
hasObserverClass ( string $className ) : boolean Is there an observer of the specified class already registered with this dispatcher?
trigger ( string $event, array $args = [] ) : array Triggers an event in the attached observers

Method Details

__construct() public méthode

Public constructor
public __construct ( Container $container )
$container FOF30\Container\Container The container this event dispatcher is attached to

attach() public méthode

Attaches an observer to the object
public attach ( Observer $observer ) : Dispatcher
$observer Observer The observer to attach
Résultat Dispatcher Ourselves, for chaining

chainHandle() public méthode

Asks each observer to handle an event based on the provided arguments. The first observer to return a non-null result wins. This is a *very* simplistic implementation of the Chain of Command pattern.
public chainHandle ( string $event, array $args = [] ) : mixed
$event string The event name to handle
$args array The arguments to the event
Résultat mixed Null if the event can't be handled by any observer

detach() public méthode

Detaches an observer from the object
public detach ( Observer $observer ) : Dispatcher
$observer Observer The observer to detach
Résultat Dispatcher Ourselves, for chaining

getContainer() public méthode

Returns the container this event dispatcher is attached to
public getContainer ( ) : Container
Résultat FOF30\Container\Container

getObserverByClass() public méthode

Returns an observer attached to this behaviours dispatcher by its class name
public getObserverByClass ( string $className ) : null | Observer
$className string The class name of the observer object to return
Résultat null | Observer

hasObserver() public méthode

Is an observer object already registered with this dispatcher?
public hasObserver ( Observer $observer ) : boolean
$observer Observer The observer to check if it's attached
Résultat boolean

hasObserverClass() public méthode

Is there an observer of the specified class already registered with this dispatcher?
public hasObserverClass ( string $className ) : boolean
$className string The observer class name to check if it's attached
Résultat boolean

trigger() public méthode

Triggers an event in the attached observers
public trigger ( string $event, array $args = [] ) : array
$event string The event to attach
$args array Arguments to the event handler
Résultat array

Property Details

$container protected_oe property

The container this event dispatcher is attached to
protected $container

$events protected_oe property

Maps events to observers
protected $events

$observers protected_oe property

The observers attached to the dispatcher
protected $observers