Newer
Older
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
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpFoundation\SessionStorage;
/**
* ArraySessionStorage mocks the session for unit tests.
*
* When doing functional testing, you should use FilesystemSessionStorage instead.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Bulat Shakirzyanov <mallluhuct@gmail.com>
*/
class ArraySessionStorage implements SessionStorageInterface
{
private $data = array();
public function read($key, $default = null)
{
return array_key_exists($key, $this->data) ? $this->data[$key] : $default;
}
public function regenerate($destroy = false)
{
if ($destroy) {
$this->data = array();
}
return true;
}
public function remove($key)
{
unset($this->data[$key]);
}
public function start()
{
}
public function getId()
{
}
public function write($key, $data)
{
$this->data[$key] = $data;
}
}