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 abstract class AbstractProxy
20 * Flag if handler wraps an internal PHP session handler (using \SessionHandler).
24 protected $wrapper = false;
29 protected $saveHandlerName;
32 * Gets the session.save_handler name.
36 public function getSaveHandlerName()
38 return $this->saveHandlerName;
42 * Is this proxy handler and instance of \SessionHandlerInterface.
46 public function isSessionHandlerInterface()
48 return $this instanceof \SessionHandlerInterface;
52 * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
56 public function isWrapper()
58 return $this->wrapper;
62 * Has a session started?
66 public function isActive()
68 return \PHP_SESSION_ACTIVE === session_status();
72 * Gets the session ID.
76 public function getId()
82 * Sets the session ID.
86 * @throws \LogicException
88 public function setId($id)
90 if ($this->isActive()) {
91 throw new \LogicException('Cannot change the ID of an active session');
98 * Gets the session name.
102 public function getName()
104 return session_name();
108 * Sets the session name.
110 * @param string $name
112 * @throws \LogicException
114 public function setName($name)
116 if ($this->isActive()) {
117 throw new \LogicException('Cannot change the name of an active session');