1: <?php
2: namespace Ratchet\Session\Storage\Proxy;
3: use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
4:
5: class VirtualProxy extends SessionHandlerProxy {
6: /**
7: * @var string
8: */
9: protected $_sessionId;
10:
11: /**
12: * @var string
13: */
14: protected $_sessionName;
15:
16: /**
17: * {@inheritdoc}
18: */
19: public function __construct(\SessionHandlerInterface $handler) {
20: parent::__construct($handler);
21:
22: $this->saveHandlerName = 'user';
23: $this->_sessionName = ini_get('session.name');
24: }
25:
26: /**
27: * {@inheritdoc}
28: */
29: public function getId() {
30: return $this->_sessionId;
31: }
32:
33: /**
34: * {@inheritdoc}
35: */
36: public function setId($id) {
37: $this->_sessionId = $id;
38: }
39:
40: /**
41: * {@inheritdoc}
42: */
43: public function getName() {
44: return $this->_sessionName;
45: }
46:
47: /**
48: * DO NOT CALL THIS METHOD
49: * @internal
50: */
51: public function setName($name) {
52: throw new \RuntimeException("Can not change session name in VirtualProxy");
53: }
54: }
55: