PHP Class TestDispatcher

Inheritance: extends Dispatcher
Show file Open project: tzookb/tbmsg Class Usage Examples

Public Methods

Method Description
fire ( string $event, mixed $payload = [], boolean $halt = false ) : array | null Fire an event and call the listeners.
firing ( ) : string Get the event that is currently firing.
flush ( string $event ) : void Flush a set of pushed events.
forget ( string $event ) : void Remove a set of listeners from the dispatcher.
forgetPushed ( ) : void Forget all of the queued listeners.
hasListeners ( string $eventName ) : boolean Determine if a given event has listeners.
listen ( string | array $events, mixed $listener, integer $priority ) : void Register an event listener with the dispatcher.
push ( string $event, array $payload = [] ) : void Register an event and payload to be fired later.
subscribe ( object | string $subscriber ) : void Register an event subscriber with the dispatcher.
until ( string $event, array $payload = [] ) : mixed Fire an event until the first non-null response is returned.

Method Details

fire() public method

Fire an event and call the listeners.
public fire ( string $event, mixed $payload = [], boolean $halt = false ) : array | null
$event string
$payload mixed
$halt boolean
return array | null

firing() public method

Get the event that is currently firing.
public firing ( ) : string
return string

flush() public method

Flush a set of pushed events.
public flush ( string $event ) : void
$event string
return void

forget() public method

Remove a set of listeners from the dispatcher.
public forget ( string $event ) : void
$event string
return void

forgetPushed() public method

Forget all of the queued listeners.
public forgetPushed ( ) : void
return void

hasListeners() public method

Determine if a given event has listeners.
public hasListeners ( string $eventName ) : boolean
$eventName string
return boolean

listen() public method

Register an event listener with the dispatcher.
public listen ( string | array $events, mixed $listener, integer $priority ) : void
$events string | array
$listener mixed
$priority integer
return void

push() public method

Register an event and payload to be fired later.
public push ( string $event, array $payload = [] ) : void
$event string
$payload array
return void

subscribe() public method

Register an event subscriber with the dispatcher.
public subscribe ( object | string $subscriber ) : void
$subscriber object | string
return void

until() public method

Fire an event until the first non-null response is returned.
public until ( string $event, array $payload = [] ) : mixed
$event string
$payload array
return mixed