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); } }
/** * Test that the event class properties are mutable */ public function testPropertiesAreMutable() { $this->event->setType('event'); $this->assertTrue('event' === $this->event->getType()); }