mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-04 10:24:07 +02:00
type hint all the things
This commit is contained in:
parent
28589d505d
commit
3f9e613e77
34 changed files with 287 additions and 309 deletions
|
|
@ -23,7 +23,7 @@ class AuthProvider extends BaseProvider {
|
|||
return $this->generator->generateString(32, Generator::CHAR_ALNUM);
|
||||
}
|
||||
|
||||
public function setUser(string $token, SteamId $steamid, string $key) {
|
||||
public function setUser(string $token, SteamId $steamid, string $key): void {
|
||||
apcu_store($token, [
|
||||
'name' => $steamid->getNickname(),
|
||||
'steamid' => $steamid->getSteamId64(),
|
||||
|
|
@ -31,14 +31,17 @@ class AuthProvider extends BaseProvider {
|
|||
]);
|
||||
}
|
||||
|
||||
public function getUser(string $token) {
|
||||
/**
|
||||
* @return (string|null)[]
|
||||
*/
|
||||
public function getUser(string $token): array {
|
||||
$found = true;
|
||||
$result = apcu_fetch($token, $found);
|
||||
|
||||
return $found ? $result : ['name' => null, 'steamid' => null, 'key' => null];
|
||||
}
|
||||
|
||||
public function logout($token) {
|
||||
public function logout(string $token): void {
|
||||
apcu_delete($token);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue