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

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <[email protected]>
  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. /**
  12.  * @author Drak <[email protected]>
  13.  */
  14. class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface\SessionUpdateTimestampHandlerInterface
  15. {
  16.     protected $handler;
  17.     public function __construct(\SessionHandlerInterface $handler)
  18.     {
  19.         $this->handler $handler;
  20.         $this->wrapper $handler instanceof \SessionHandler;
  21.         $this->saveHandlerName $this->wrapper \ini_get('session.save_handler') : 'user';
  22.     }
  23.     public function getHandler(): \SessionHandlerInterface
  24.     {
  25.         return $this->handler;
  26.     }
  27.     // \SessionHandlerInterface
  28.     public function open(string $savePathstring $sessionName): bool
  29.     {
  30.         return $this->handler->open($savePath$sessionName);
  31.     }
  32.     public function close(): bool
  33.     {
  34.         return $this->handler->close();
  35.     }
  36.     public function read(string $sessionId): string|false
  37.     {
  38.         return $this->handler->read($sessionId);
  39.     }
  40.     public function write(string $sessionIdstring $data): bool
  41.     {
  42.         return $this->handler->write($sessionId$data);
  43.     }
  44.     public function destroy(string $sessionId): bool
  45.     {
  46.         return $this->handler->destroy($sessionId);
  47.     }
  48.     public function gc(int $maxlifetime): int|false
  49.     {
  50.         return $this->handler->gc($maxlifetime);
  51.     }
  52.     public function validateId(string $sessionId): bool
  53.     {
  54.         return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId);
  55.     }
  56.     public function updateTimestamp(string $sessionIdstring $data): bool
  57.     {
  58.         return $this->handler instanceof \SessionUpdateTimestampHandlerInterface $this->handler->updateTimestamp($sessionId$data) : $this->write($sessionId$data);
  59.     }
  60. }