PHP Class Resque\Event

Author: Chris Boulton ([email protected])
Show file Open project: mjphaynes/php-resque Class Usage Examples

Protected Properties

Property Type Description
$events containing all registered callbacks, indexed by event name

Public Methods

Method Description
clear ( ) Clear all registered listeners.
eventName ( integer $event ) : string | false Returns the name of the given event from constant
fire ( string $event, mixed $data = null ) : true Raise a given event with the supplied data.
forget ( string $event, mixed $callback ) : true Stop a given callback from listening on a specific event.
listen ( string $event, mixed $callback ) : true Listen in on a given event to have a specified callback fired.

Method Details

clear() public static method

Clear all registered listeners.
public static clear ( )

eventName() public static method

Returns the name of the given event from constant
public static eventName ( integer $event ) : string | false
$event integer Event constant
return string | false

fire() public static method

Raise a given event with the supplied data.
public static fire ( string $event, mixed $data = null ) : true
$event string Name of event to be raised
$data mixed Data that should be passed to each callback (optional)
return true

forget() public static method

Stop a given callback from listening on a specific event.
public static forget ( string $event, mixed $callback ) : true
$event string Name of event
$callback mixed The callback as defined when listen() was called
return true

listen() public static method

Listen in on a given event to have a specified callback fired.
public static listen ( string $event, mixed $callback ) : true
$event string Name of event to listen on.
$callback mixed Any callback callable by call_user_func_array
return true

Property Details

$events protected static property

containing all registered callbacks, indexed by event name
protected static $events