Exemplo n.º 1
0
 protected function dispatchEvent(EventInterface $aEvent, $aOptions = null)
 {
     $options = ['listener' => null];
     if ($aOptions) {
         $options = array_replace($options, $aOptions);
     }
     $type = $aEvent->getType();
     $listeners = $options['listener'] ? [$options['listener']] : (array_key_exists($type, $this->listeners) ? $this->listeners[$type] : []);
     foreach ($listeners as $listener) {
         $listener($aEvent);
     }
 }
Exemplo n.º 2
0
 /**
  * Test that the event class properties are mutable
  */
 public function testPropertiesAreMutable()
 {
     $this->event->setType('event');
     $this->assertTrue('event' === $this->event->getType());
 }