Repository navigation
Expand file tree
/
Copy pathNullHandler.php
More file actions
84 lines (75 loc) · 1.83 KB
/
Copy pathNullHandler.php
File metadata and controls
84 lines (75 loc) · 1.83 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Session\Handler;
use SessionHandlerInterface;
class NullHandler implements SessionHandlerInterface
{
/**
* Close the session.
*
* @see https://php.net/manual/en/sessionhandlerinterface.close.php
*/
public function close(): bool
{
return true;
}
/**
* Destroy a session.
*
* @see https://php.net/manual/en/sessionhandlerinterface.destroy.php
* @param string $id the session ID being destroyed
*/
public function destroy(string $id): bool
{
return true;
}
/**
* Cleanup old sessions.
*
* @see https://php.net/manual/en/sessionhandlerinterface.gc.php
*/
public function gc(int $max_lifetime): false|int
{
return 0;
}
/**
* Initialize session.
*
* @see https://php.net/manual/en/sessionhandlerinterface.open.php
* @param string $path the path where to store/retrieve the session
* @param string $name the session name
*/
public function open(string $path, string $name): bool
{
return true;
}
/**
* Read session data.
*
* @see https://php.net/manual/en/sessionhandlerinterface.read.php
* @param string $id the session id to read data for
* @return string
*/
public function read(string $id): false|string
{
return '';
}
/**
* Write session data.
*
* @see https://php.net/manual/en/sessionhandlerinterface.write.php
* @param string $id the session id
*/
public function write(string $id, string $data): bool
{
return true;
}
}