[ Index ]

PHP Cross Reference of phpBB-3.3.2-deutsch

title

Body

[close]

/vendor/symfony/http-foundation/Session/Storage/Handler/ -> WriteCheckSessionHandler.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
  13  
  14  /**
  15   * Wraps another SessionHandlerInterface to only write the session when it has been modified.
  16   *
  17   * @author Adrien Brault <adrien.brault@gmail.com>
  18   *
  19   * @deprecated since version 3.4, to be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.
  20   */
  21  class WriteCheckSessionHandler implements \SessionHandlerInterface
  22  {
  23      private $wrappedSessionHandler;
  24  
  25      /**
  26       * @var array sessionId => session
  27       */
  28      private $readSessions;
  29  
  30      public function __construct(\SessionHandlerInterface $wrappedSessionHandler)
  31      {
  32          @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', self::class), \E_USER_DEPRECATED);
  33  
  34          $this->wrappedSessionHandler = $wrappedSessionHandler;
  35      }
  36  
  37      /**
  38       * {@inheritdoc}
  39       */
  40      public function close()
  41      {
  42          return $this->wrappedSessionHandler->close();
  43      }
  44  
  45      /**
  46       * {@inheritdoc}
  47       */
  48      public function destroy($sessionId)
  49      {
  50          return $this->wrappedSessionHandler->destroy($sessionId);
  51      }
  52  
  53      /**
  54       * {@inheritdoc}
  55       */
  56      public function gc($maxlifetime)
  57      {
  58          return $this->wrappedSessionHandler->gc($maxlifetime);
  59      }
  60  
  61      /**
  62       * {@inheritdoc}
  63       */
  64      public function open($savePath, $sessionName)
  65      {
  66          return $this->wrappedSessionHandler->open($savePath, $sessionName);
  67      }
  68  
  69      /**
  70       * {@inheritdoc}
  71       */
  72      public function read($sessionId)
  73      {
  74          $session = $this->wrappedSessionHandler->read($sessionId);
  75  
  76          $this->readSessions[$sessionId] = $session;
  77  
  78          return $session;
  79      }
  80  
  81      /**
  82       * {@inheritdoc}
  83       */
  84      public function write($sessionId, $data)
  85      {
  86          if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
  87              return true;
  88          }
  89  
  90          return $this->wrappedSessionHandler->write($sessionId, $data);
  91      }
  92  }


Generated: Wed Nov 11 20:28:18 2020 Cross-referenced by PHPXref 0.7.1