PHP Trait PHPDaemon\Traits\EventHandlers

Author: Vasily Zorin ([email protected])
Afficher le fichier Open project: kakserpom/phpdaemon

Protected Properties

Свойство Type Description
$addThisToEvents Unshift $this to arguments of callback?
$eventHandlers Event handlers
$lastEventName Last called event name

Méthodes publiques

Méthode Description
bind ( string | array $event, callable $cb ) : this Bind event or events
event ( string $name, $args ) : this Propagate event
getLastEventName ( ) : string Use it to define event name, when one callback was bind to more than one events
off ( string | array $event, callable $cb = null ) : this Unbind event(s) or callback from event(s)
on ( string | array $event, callable $cb ) : this Bind event or events
trigger ( string $name, $args ) : this Propagate event
triggerAndCount ( string $name, $args ) : integer Propagate event
unbind ( string | array $event, callable $cb = null ) : this Unbind event(s) or callback from event(s)

Méthodes protégées

Méthode Description
cleanupEventHandlers ( ) : void Clean up all events

Method Details

bind() public méthode

Bind event or events
public bind ( string | array $event, callable $cb ) : this
$event string | array Event name
$cb callable Callback
Résultat this

cleanupEventHandlers() protected méthode

Clean up all events
protected cleanupEventHandlers ( ) : void
Résultat void

event() public méthode

Propagate event
public event ( string $name, $args ) : this
$name string Event name
$args Arguments
Résultat this

getLastEventName() public méthode

Use it to define event name, when one callback was bind to more than one events
public getLastEventName ( ) : string
Résultat string

off() public méthode

Unbind event(s) or callback from event(s)
public off ( string | array $event, callable $cb = null ) : this
$event string | array Event name
$cb callable Callback, optional
Résultat this

on() public méthode

Bind event or events
public on ( string | array $event, callable $cb ) : this
$event string | array Event name
$cb callable Callback
Résultat this

trigger() public méthode

Propagate event
public trigger ( string $name, $args ) : this
$name string Event name
$args Arguments
Résultat this

triggerAndCount() public méthode

Propagate event
public triggerAndCount ( string $name, $args ) : integer
$name string Event name
$args Arguments
Résultat integer

unbind() public méthode

Unbind event(s) or callback from event(s)
public unbind ( string | array $event, callable $cb = null ) : this
$event string | array Event name
$cb callable Callback, optional
Résultat this

Property Details

$addThisToEvents protected_oe property

Unshift $this to arguments of callback?
protected $addThisToEvents

$eventHandlers protected_oe property

Event handlers
protected $eventHandlers

$lastEventName protected_oe property

Last called event name
protected $lastEventName