vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php line 91

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy;
  11. use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
  12. /**
  13.  * @author Drak <drak@zikula.org>
  14.  */
  15. class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface
  16. {
  17.     protected $handler;
  18.     public function __construct(\SessionHandlerInterface $handler)
  19.     {
  20.         $this->handler $handler;
  21.         $this->wrapper $handler instanceof \SessionHandler;
  22.         $this->saveHandlerName $this->wrapper || ($handler instanceof StrictSessionHandler && $handler->isWrapper()) ? \ini_get('session.save_handler') : 'user';
  23.     }
  24.     /**
  25.      * @return \SessionHandlerInterface
  26.      */
  27.     public function getHandler()
  28.     {
  29.         return $this->handler;
  30.     }
  31.     // \SessionHandlerInterface
  32.     /**
  33.      * @return bool
  34.      */
  35.     #[\ReturnTypeWillChange]
  36.     public function open($savePath$sessionName)
  37.     {
  38.         return $this->handler->open($savePath$sessionName);
  39.     }
  40.     /**
  41.      * @return bool
  42.      */
  43.     #[\ReturnTypeWillChange]
  44.     public function close()
  45.     {
  46.         return $this->handler->close();
  47.     }
  48.     /**
  49.      * @return string|false
  50.      */
  51.     #[\ReturnTypeWillChange]
  52.     public function read($sessionId)
  53.     {
  54.         return $this->handler->read($sessionId);
  55.     }
  56.     /**
  57.      * @return bool
  58.      */
  59.     #[\ReturnTypeWillChange]
  60.     public function write($sessionId$data)
  61.     {
  62.         return $this->handler->write($sessionId$data);
  63.     }
  64.     /**
  65.      * @return bool
  66.      */
  67.     #[\ReturnTypeWillChange]
  68.     public function destroy($sessionId)
  69.     {
  70.         return $this->handler->destroy($sessionId);
  71.     }
  72.     /**
  73.      * @return int|false
  74.      */
  75.     #[\ReturnTypeWillChange]
  76.     public function gc($maxlifetime)
  77.     {
  78.         return $this->handler->gc($maxlifetime);
  79.     }
  80.     /**
  81.      * @return bool
  82.      */
  83.     #[\ReturnTypeWillChange]
  84.     public function validateId($sessionId)
  85.     {
  86.         return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
  87.     }
  88.     /**
  89.      * @return bool
  90.      */
  91.     #[\ReturnTypeWillChange]
  92.     public function updateTimestamp($sessionId$data)
  93.     {
  94.         return $this->handler instanceof \SessionUpdateTimestampHandlerInterface $this->handler->updateTimestamp($sessionId$data) : $this->write($sessionId$data);
  95.     }
  96. }