Dragon-Knight/server/app/app.php

28 lines
563 B
PHP

<?php
/*
The app container exists to be a dependency container for the game.
*/
class App
{
public static Database $db;
private static string $dbPath;
public static Request $req;
public function __construct(string $dbPath)
{
self::$req = new Request(); // the current request
self::$db = new Database($dbPath); // the database
self::$dbPath = $dbPath; // the database path
}
public static function performDatabaseReset(): void
{
if (file_exists(self::$dbPath)) {
unlink(self::$dbPath);
self::$db = new Database(self::$dbPath);
}
}
}