dbConn = $dbConn; $dbConn->execute(self::DB_INIT); } public function getDbQueryCount(): int { $result = $this->dbConn->query('SHOW SESSION STATUS LIKE "Questions"'); return $result->next() ? $result->getInteger(0) : 0; } public function createMigrationManager(): DbMigrationManager { return new DbMigrationManager($this->dbConn, 'awk_' . DbMigrationManager::DEFAULT_TABLE); } public function createMigrationRepo(): IDbMigrationRepo { return new FsDbMigrationRepo(AWK_DIR_DBM); } public function getRouter(): IRouter { return $this->router->getRouter(); } public function setUpHttp(): void { $this->router = new HttpFx; $this->router->use('/', function($response) { $response->setPoweredBy('Awaki'); }); $this->registerErrorPages(); $this->registerHttpRoutes(); } public function dispatchHttp(?HttpRequest $request = null): void { $this->router->dispatch($request); } private function registerErrorPages(): void { $this->router->addErrorHandler(404, function($response) { $response->accelRedirect('/err404.html'); $response->setTypeHTML(); }); $this->router->addErrorHandler(500, function($response) { $response->accelRedirect('/err500.html'); $response->setTypeHTML(); }); } private function registerHttpRoutes(): void { new RedirectorRoutes($this->router, $this->dbConn); } }