PHP Class JAXLEvent, JAXL

As a rule of thumb, only 1 hook can be registered for an event, while more than 1 filter is allowed for an event hook and filter both cannot be applied on an event
Author: abhinavsingh
ファイルを表示 Open project: jaxl/JAXL Class Usage Examples

Protected Properties

Property Type Description
$common
$reg

Public Methods

Method Description
__construct ( array $common = [] )
__destruct ( )
add ( string $ev, callable $cb, integer $priority ) : string Add callback on a event.
del ( string $ref ) Remove previous registered callback.
emit ( string $ev, array $data = [] ) : array Emit event to notify registered callbacks.
exists ( string $ev ) : boolean
getRegistry ( ) : array

Method Details

__construct() public method

public __construct ( array $common = [] )
$common array

__destruct() public method

public __destruct ( )

add() public method

Callback'd method must return true to be persistent, otherwise if returned null or false, callback will be removed automatically.
public add ( string $ev, callable $cb, integer $priority ) : string
$ev string
$cb callable
$priority integer
return string Reference to be used while deleting callback.

del() public method

Remove previous registered callback.
public del ( string $ref )
$ref string

emit() public method

TODO: Is a pqueue required here for performance enhancement in case we have too many cbs on a specific event?
public emit ( string $ev, array $data = [] ) : array
$ev string
$data array
return array

exists() public method

public exists ( string $ev ) : boolean
$ev string
return boolean

getRegistry() public method

public getRegistry ( ) : array
return array List of registered events.

Property Details

$common protected_oe property

protected $common

$reg protected_oe property

protected $reg