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
;
15 * @author Drak <drak@zikula.org>
17 class SessionHandlerProxy
extends AbstractProxy
implements \SessionHandlerInterface
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
36 public function open($savePath, $sessionName)
38 $return = (bool) $this->handler
->open($savePath, $sessionName);
40 if (true === $return) {
50 public function close()
52 $this->active
= false;
54 return (bool) $this->handler
->close();
60 public function read($sessionId)
62 return (string) $this->handler
->read($sessionId);
68 public function write($sessionId, $data)
70 return (bool) $this->handler
->write($sessionId, $data);
76 public function destroy($sessionId)
78 return (bool) $this->handler
->destroy($sessionId);
84 public function gc($maxlifetime)
86 return (bool) $this->handler
->gc($maxlifetime);