Phergie_Event_Handler::replaceEvents PHP Method

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
    public function replaceEvents(array $events)
    {
        $this->events = $events;
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Tests that the events contained within the handler can be replaced
  * with a different set of events.
  *
  * @return void
  * @depends testAddEventWithValidData
  */
 public function testReplaceEvents()
 {
     $this->addMockEvent();
     $expected = array();
     $this->events->replaceEvents($expected);
     $actual = $this->events->getEvents();
     $this->assertSame($expected, $actual);
 }