user = $user; $this->token = hash("sha512", $token, false); $this->tokenType = $type; $this->validUntil = (new \DateTime())->modify("+$validHours HOUR"); $this->used = false; } public function getType(): string { return $this->tokenType; } public function invalidate(SQL $sql): bool { $this->used = true; return $this->save($sql, ["used"]); } public function getUser(): User { return $this->user; } }