class Token { private $tokenValue; private $expirationDate; private $isPermanent; public function __construct($tokenValue, $expirationDate, $isPermanent = false) { $this->tokenValue = $tokenValue; $this->expirationDate = $expirationDate; $this->isPermanent = $isPermanent; } public function getTokenValue() { return $this->tokenValue; } public function getExpirationDate() { return $this->expirationDate; } public function isPermanent() { return $this->isPermanent; } public function saveToDatabase($pdo) { $stmt = $pdo->prepare("INSERT INTO tokens (token_value, expiration_date, is_permanent) VALUES (:tokenValue, :expirationDate, :isPermanent)"); $stmt->execute([ ':tokenValue' => $this->tokenValue, ':expirationDate' => $this->expirationDate, ':isPermanent' => $this->isPermanent ]); } public static function retrieveFromDatabase($pdo, $tokenValue) { $stmt = $pdo->prepare("SELECT * FROM tokens WHERE token_value = :tokenValue"); $stmt->execute([':tokenValue' => $tokenValue]); return $stmt->fetch(PDO::FETCH_ASSOC); } }