getEvents() public method

Returns the current event queue.
public getEvents ( ) : array
return array Enumerated array of Phergie_Event_Command objects
Example #1
0
 /**
  * Gets the events added to the handler by the plugin
  * @param string $type
  * @return array | null
  */
 public function getResponseEvents($type = null)
 {
     if (is_string($type) && strlen($type) > 0) {
         return $this->handler->getEventsOfType($type);
     }
     return $this->handler->getEvents();
 }
Example #2
0
 /**
  * Tests that the handler supports iteration of the events it contains.
  *
  * @return void
  * @depends testAddEventWithValidData
  */
 public function testImplementsGetIterator()
 {
     $reflector = new ReflectionClass('Phergie_Event_Handler');
     $this->assertTrue($reflector->implementsInterface('IteratorAggregate'));
     $this->addMockEvent();
     $events = $this->events->getEvents();
     $expected = array_shift($events);
     foreach ($this->events as $actual) {
         $this->assertSame($expected, $actual);
     }
 }