// the alias for lastUsed works around case insensitivity in PostgreSQL
$sql = 'SELECT class, username, value, lastUsed AS last_used FROM rememberme_token WHERE series=:series';
$paramValues =
['series' =>
$series];
$paramTypes =
['series' => ParameterType::STRING
];
$stmt =
$this->conn->
executeQuery($sql,
$paramValues,
$paramTypes);
$row =
$stmt instanceof Result ||
$stmt instanceof DriverResult ?
$stmt->
fetchAssociative() :
$stmt->
fetch(\PDO::FETCH_ASSOC
);
if ($row) { return new PersistentToken($row['class'
],
$row['username'
],
$series,
$row['value'
],
new \
DateTimeImmutable($row['last_used'
]));
} throw new TokenNotFoundException('No token found.'
);
} /**
* @return void
*/
public function deleteTokenBySeries(string
$series) { $sql = 'DELETE FROM rememberme_token WHERE series=:series';
$paramValues =
['series' =>
$series];
$paramTypes =
['series' => ParameterType::STRING
];
$this->conn->
executeStatement($sql,
$paramValues,
$paramTypes);
}