composer package updates
[openemr.git] / vendor / symfony / http-foundation / Session / Storage / Proxy / SessionHandlerProxy.php
blob6190d3ed1fd94c683ec4690e6a4501dc0a7aae43
1 <?php
3 /*
4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
14 /**
15 * @author Drak <drak@zikula.org>
17 class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface
19 protected $handler;
21 /**
22 * @param \SessionHandlerInterface $handler
24 public function __construct(\SessionHandlerInterface $handler)
26 $this->handler = $handler;
27 $this->wrapper = ($handler instanceof \SessionHandler);
28 $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
31 // \SessionHandlerInterface
33 /**
34 * {@inheritdoc}
36 public function open($savePath, $sessionName)
38 $return = (bool) $this->handler->open($savePath, $sessionName);
40 if (true === $return) {
41 $this->active = true;
44 return $return;
47 /**
48 * {@inheritdoc}
50 public function close()
52 $this->active = false;
54 return (bool) $this->handler->close();
57 /**
58 * {@inheritdoc}
60 public function read($sessionId)
62 return (string) $this->handler->read($sessionId);
65 /**
66 * {@inheritdoc}
68 public function write($sessionId, $data)
70 return (bool) $this->handler->write($sessionId, $data);
73 /**
74 * {@inheritdoc}
76 public function destroy($sessionId)
78 return (bool) $this->handler->destroy($sessionId);
81 /**
82 * {@inheritdoc}
84 public function gc($maxlifetime)
86 return (bool) $this->handler->gc($maxlifetime);