mirror of
https://github.com/friendica/friendica
synced 2025-04-19 10:30:10 +00:00
Changes:
- added more type-hints - added missing documentation
This commit is contained in:
parent
94eb426151
commit
9691bb06fb
2 changed files with 209 additions and 184 deletions
|
@ -40,16 +40,16 @@ class OpenWebAuthToken
|
|||
* @return boolean
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function create($type, $uid, $token, $meta)
|
||||
public static function create(string $type, uid $uid, string $token, string $meta)
|
||||
{
|
||||
$fields = [
|
||||
"type" => $type,
|
||||
"uid" => $uid,
|
||||
"token" => $token,
|
||||
"meta" => $meta,
|
||||
"created" => DateTimeFormat::utcNow()
|
||||
'type' => $type,
|
||||
'uid' => $uid,
|
||||
'token' => $token,
|
||||
'meta' => $meta,
|
||||
'created' => DateTimeFormat::utcNow()
|
||||
];
|
||||
return DBA::insert("openwebauth-token", $fields);
|
||||
return DBA::insert('openwebauth-token', $fields);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,15 +62,15 @@ class OpenWebAuthToken
|
|||
* @return string|boolean The meta enry or false if not found.
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getMeta($type, $uid, $token)
|
||||
public static function getMeta(string $type, int $uid, string $token)
|
||||
{
|
||||
$condition = ["type" => $type, "uid" => $uid, "token" => $token];
|
||||
$condition = ['type' => $type, 'uid' => $uid, 'token' => $token];
|
||||
|
||||
$entry = DBA::selectFirst("openwebauth-token", ["id", "meta"], $condition);
|
||||
$entry = DBA::selectFirst('openwebauth-token', ['id', 'meta'], $condition);
|
||||
if (DBA::isResult($entry)) {
|
||||
DBA::delete("openwebauth-token", ["id" => $entry["id"]]);
|
||||
DBA::delete('openwebauth-token', ['id' => $entry['id']]);
|
||||
|
||||
return $entry["meta"];
|
||||
return $entry['meta'];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ class OpenWebAuthToken
|
|||
* @param string $interval SQL compatible time interval
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function purge($type, $interval)
|
||||
public static function purge(string $type, string $interval)
|
||||
{
|
||||
$condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval];
|
||||
DBA::delete("openwebauth-token", $condition);
|
||||
$condition = ['`type` = ? AND `created` < ?', $type, DateTimeFormat::utcNow() . ' - INTERVAL ' . $interval];
|
||||
DBA::delete('openwebauth-token', $condition);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue