/** * Automatically maps event listeners associated with a class using the driver provided to this instance and * registers them. * * @param object $instance * @throws \BedRest\Events\MappingException */ public function addClassListeners($instance) { if (!$this->driver) { throw Exception::noDriver(); } foreach ($this->driver->getListenersForClass($instance) as $listener) { $this->addListener($listener['event'], array($instance, $listener['method'])); } }