NullHandler::gc()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * NullHandler.php
4
 *
5
 * @copyright      More in license.md
6
 * @license        http://www.ipublikuj.eu
7
 * @author         Adam Kadlec http://www.ipublikuj.eu
8
 * @package        iPublikuj:WebSocketSession!
9
 * @subpackage     Session
10
 * @since          1.0.0
11
 *
12
 * @date           19.02.17
13
 */
14
15
declare(strict_types = 1);
16
17
namespace IPub\WebSocketsSession\Session;
18
19
use Nette;
20
21
/**
22
 * Null session handler can be used in unit testing or in a situations where persisted sessions are not desired
23
 *
24
 * @package        iPublikuj:WebSocketSession!
25
 * @subpackage     Session
26
 *
27
 * @author         Adam Kadlec <[email protected]>
28
 */
29 1
class NullHandler implements \SessionHandlerInterface
30
{
31
	/**
32
	 * Implement nette smart magic
33
	 */
34 1
	use Nette\SmartObject;
35
36
	/**
37
	 * {@inheritdoc}
38
	 */
39
	public function open($savePath, $sessionName)
40
	{
41
		return TRUE;
42
	}
43
44
	/**
45
	 * {@inheritdoc}
46
	 */
47
	public function close()
48
	{
49
		return TRUE;
50
	}
51
52
	/**
53
	 * {@inheritdoc}
54
	 */
55
	public function read($sessionId)
56
	{
57
		return '';
58
	}
59
60
	/**
61
	 * {@inheritdoc}
62
	 */
63
	public function write($sessionId, $data)
64
	{
65
		return TRUE;
66
	}
67
68
	/**
69
	 * {@inheritdoc}
70
	 */
71
	public function destroy($sessionId)
72
	{
73
		return TRUE;
74
	}
75
76
	/**
77
	 * {@inheritdoc}
78
	 */
79
	public function gc($maxLifetime)
80
	{
81
		return TRUE;
82
	}
83
}
84