PHP Class Phergie_Event_Handler, phergie

Author: Phergie Development Team ([email protected])
Inheritance: implements IteratorAggregate, implements Countable
Show file Open project: phergie/phergie Class Usage Examples

Protected Properties

Property Type Description
$events array Current queue of events

Public Methods

Method Description
__construct ( ) : void Constructor to initialize the event queue.
addEvent ( Phergie_Plugin_Abstract $plugin, string $type, array $args = [] ) : Phergie_Event_Handler Adds an event to the queue.
clearEvents ( ) : Phergie_Event_Handler Clears the event queue.
count ( ) : integer Returns the number of events in the event queue
getEvents ( ) : array Returns the current event queue.
getEventsOfType ( string $type ) : array Returns a list of events of a specified type.
getIterator ( ) : ArrayIterator Returns an iterator for the current event queue.
hasEventOfType ( string $type ) : boolean Returns whether an event of the given type exists in the queue.
removeEvent ( Phergie_Event_Command $event ) : Phergie_Event_Handler Removes a single event from the event queue.
replaceEvents ( array $events ) : Phergie_Event_Handler Replaces the current event queue with a given queue of events.

Method Details

__construct() public method

Constructor to initialize the event queue.
public __construct ( ) : void
return void

addEvent() public method

Adds an event to the queue.
public addEvent ( Phergie_Plugin_Abstract $plugin, string $type, array $args = [] ) : Phergie_Event_Handler
$plugin Phergie_Plugin_Abstract Plugin originating the event
$type string Event type, corresponding to a Phergie_Event_Command::TYPE_* constant
$args array Optional event arguments
return Phergie_Event_Handler Provides a fluent interface

clearEvents() public method

Clears the event queue.
public clearEvents ( ) : Phergie_Event_Handler
return Phergie_Event_Handler Provides a fluent interface

count() public method

Returns the number of events in the event queue
public count ( ) : integer
return integer number of queued events

getEvents() public method

Returns the current event queue.
public getEvents ( ) : array
return array Enumerated array of Phergie_Event_Command objects

getEventsOfType() public method

Returns a list of events of a specified type.
public getEventsOfType ( string $type ) : array
$type string Event type from Phergie_Event_Request::TYPE_* constants
return array Array containing event instances of the specified type or an empty array if no such events were found

getIterator() public method

Returns an iterator for the current event queue.

hasEventOfType() public method

Returns whether an event of the given type exists in the queue.
public hasEventOfType ( string $type ) : boolean
$type string Event type from Phergie_Event_Request::TYPE_* constants
return boolean TRUE if an event of the specified type exists in the queue, FALSE otherwise

removeEvent() public method

Removes a single event from the event queue.
public removeEvent ( Phergie_Event_Command $event ) : Phergie_Event_Handler
$event Phergie_Event_Command Event to remove
return Phergie_Event_Handler Provides a fluent interface

replaceEvents() public method

Replaces the current event queue with a given queue of events.
public replaceEvents ( array $events ) : Phergie_Event_Handler
$events array Ordered list of objects of the class Phergie_Event_Command
return Phergie_Event_Handler Provides a fluent interface

Property Details

$events protected property

Current queue of events
protected array $events
return array