PHP 클래스 FOF30\Event\Dispatcher

상속: implements FOF30\Event\Observable
파일 보기 프로젝트 열기: akeeba/fof 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$container The container this event dispatcher is attached to
$events Maps events to observers
$observers The observers attached to the dispatcher

공개 메소드들

메소드 설명
__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

메소드 상세

__construct() 공개 메소드

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

attach() 공개 메소드

Attaches an observer to the object
public attach ( Observer $observer ) : Dispatcher
$observer Observer The observer to attach
리턴 Dispatcher Ourselves, for chaining

chainHandle() 공개 메소드

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
리턴 mixed Null if the event can't be handled by any observer

detach() 공개 메소드

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

getContainer() 공개 메소드

Returns the container this event dispatcher is attached to
public getContainer ( ) : Container
리턴 FOF30\Container\Container

getObserverByClass() 공개 메소드

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
리턴 null | Observer

hasObserver() 공개 메소드

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

hasObserverClass() 공개 메소드

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
리턴 boolean

trigger() 공개 메소드

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
리턴 array

프로퍼티 상세

$container 보호되어 있는 프로퍼티

The container this event dispatcher is attached to
protected $container

$events 보호되어 있는 프로퍼티

Maps events to observers
protected $events

$observers 보호되어 있는 프로퍼티

The observers attached to the dispatcher
protected $observers