1: <?php
2:
3: namespace PHPixie\HTTP\Context;
4:
5: /**
6: * Session storage
7: */
8: interface Session
9: {
10: /**
11: * Session id
12: * @return string|null
13: */
14: public function id();
15:
16: /**
17: * Set session id
18: * @param string $id
19: * @return void
20: */
21: public function setId($id);
22:
23: /**
24: * Get value by key, or if missing return the default value
25: * @param mixed $key
26: * @param mixed $default
27: * @return mixed
28: */
29: public function get($key, $default = null);
30:
31: /**
32: * Get value by key, or if missing throw an exceptionn
33: * @param mixed $key
34: * @return mixed
35: * @throws \PHPixie\HTTP\Exception
36: */
37: public function getRequired($key);
38:
39: /**
40: * Check if key exists
41: * @param mixed $key
42: * @return bool
43: */
44: public function exists($key);
45:
46: /**
47: * Set value by key
48: * @param mixed $key
49: * @param mixed $value
50: * @return void
51: */
52: public function set($key, $value);
53:
54: /**
55: * Set value by key
56: * @param mixed $key
57: * @return void
58: */
59: public function remove($key);
60:
61: /**
62: * Get data as array
63: * @return array
64: */
65: public function asArray();
66: }