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
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 can return events it contains that are of a
  * specified type.
  *
  * @return void
  * @depends testAddEventWithValidData
  */
 public function testGetEventsOfType()
 {
     $expected = array();
     $actual = $this->events->getEventsOfType($this->type);
     $this->assertSame($expected, $actual);
     $this->addMockEvent();
     $expected = $this->events->getEvents();
     $actual = $this->events->getEventsOfType($this->type);
     $this->assertSame($expected, $actual);
 }