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, \SessionUpdateTimestampHandlerInterface
21 public function __construct(\SessionHandlerInterface $handler)
23 $this->handler = $handler;
24 $this->wrapper = ($handler instanceof \SessionHandler);
25 $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user';
29 * @return \SessionHandlerInterface
31 public function getHandler()
33 return $this->handler;
36 // \SessionHandlerInterface
41 public function open($savePath, $sessionName)
43 return (bool) $this->handler->open($savePath, $sessionName);
49 public function close()
51 return (bool) $this->handler->close();
57 public function read($sessionId)
59 return (string) $this->handler->read($sessionId);
65 public function write($sessionId, $data)
67 return (bool) $this->handler->write($sessionId, $data);
73 public function destroy($sessionId)
75 return (bool) $this->handler->destroy($sessionId);
81 public function gc($maxlifetime)
83 return (bool) $this->handler->gc($maxlifetime);
89 public function validateId($sessionId)
91 return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
97 public function updateTimestamp($sessionId, $data)
99 return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data);