summaryrefslogtreecommitdiffstats
path: root/tests/Stubs/Session.php
blob: 949a126d9a533dc6f20a1248fea95af2bec21d48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

/**
 * Test stub for legacy global Session class.
 */
class Session
{
	public static array $store = [];
	public static ?array $lastCreate = null;

	public static function reset(): void
	{
		self::$store = [];
		self::$lastCreate = null;
	}

	public static function get(string $key)
	{
		return self::$store[$key] ?? false;
	}

	public static function set(string $key, $value, $validMinutes): void
	{
		self::$store[$key] = $value;
	}

	public static function create(string $salt, int $userId, bool $fixedAddress): void
	{
		self::$lastCreate = ['salt' => $salt, 'userId' => $userId, 'fixed' => $fixedAddress];
		self::$store['uid'] = $userId;
	}

	public static function delete(): void
	{
		self::$store = [];
	}
}