database = $database; } /** * Insert a deleted user by username. * * @throws \Exception If the username could not be inserted */ public function insertByUsername(string $username): void { $result = $this->database->insert('userd', ['username' => $username]); if ($result === false) { throw new Exception(sprintf('Error while inserting username `%s` as deleted user.', $username)); } } /** * Check if a deleted username exists. * * @throws \Exception */ public function existsByUsername(string $username): bool { return $this->database->exists('userd', ['username' => $username]); } }