/** * Connects to a database. * @return void */ public final function connect() { $event = $this->onEvent ? new Event($this, Event::CONNECT) : NULL; try { $this->driver->connect($this->config); $this->connected = TRUE; $event && $this->onEvent($event->done()); } catch (Exception $e) { $event && $this->onEvent($event->done($e)); throw $e; } }