X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FModel%2FOpenWebAuthToken.php;h=4186467c15ef299a3647d3dd7eda32e029ac9bf5;hb=f81192b4c3838480154301ac25cbbbed58593380;hp=802e4edf2529474a2bc02b86d7c762d372ceeed7;hpb=322b7c856ca9ba53bd9c7da50dd5c1e3c9197d56;p=friendica.git diff --git a/src/Model/OpenWebAuthToken.php b/src/Model/OpenWebAuthToken.php index 802e4edf25..4186467c15 100644 --- a/src/Model/OpenWebAuthToken.php +++ b/src/Model/OpenWebAuthToken.php @@ -1,6 +1,6 @@ $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); } /** @@ -59,18 +58,18 @@ class OpenWebAuthToken * @param int $uid The user ID. * @param string $token * - * @return string|boolean The meta enry or false if not found. + * @return string|boolean The meta entry 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; } @@ -80,12 +79,13 @@ class OpenWebAuthToken * * @param string $type Verify type. * @param string $interval SQL compatible time interval + * @return void * @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); } }