basePath = $basePath; $this->pdo = $pdo; } private function countLines(string $table): int { $stmnt = $this->pdo->prepare("SELECT count(*) FROM $table"); $stmnt->execute(); $res = $stmnt->fetch(\PDO::FETCH_BOTH); return $res[0]; } /** * @return HttpResponse some (useless) information about the server */ public function getServerInfo(): HttpResponse { return new JsonHttpResponse([ 'base_path' => $this->basePath, 'date' => (int) gettimeofday(true) * 1000, 'database' => [ 'accounts' => $this->countLines("Account") . " line(s)", 'tactics' => $this->countLines("Tactic") . " line(s)", 'teams' => $this->countLines("Team") . " line(s)", ], ]); } }