Open Journal Systems  3.3.0
StrictSessionHandler.php
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 
13 
20 {
21  private $handler;
22  private $doDestroy;
23 
24  public function __construct(\SessionHandlerInterface $handler)
25  {
26  if ($handler instanceof \SessionUpdateTimestampHandlerInterface) {
27  throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', \get_class($handler), self::class));
28  }
29 
30  $this->handler = $handler;
31  }
32 
36  public function open($savePath, $sessionName)
37  {
38  parent::open($savePath, $sessionName);
39 
40  return $this->handler->open($savePath, $sessionName);
41  }
42 
46  protected function doRead($sessionId)
47  {
48  return $this->handler->read($sessionId);
49  }
50 
54  public function updateTimestamp($sessionId, $data)
55  {
56  return $this->write($sessionId, $data);
57  }
58 
62  protected function doWrite($sessionId, $data)
63  {
64  return $this->handler->write($sessionId, $data);
65  }
66 
70  public function destroy($sessionId)
71  {
72  $this->doDestroy = true;
73  $destroyed = parent::destroy($sessionId);
74 
75  return $this->doDestroy ? $this->doDestroy($sessionId) : $destroyed;
76  }
77 
81  protected function doDestroy($sessionId)
82  {
83  $this->doDestroy = false;
84 
85  return $this->handler->destroy($sessionId);
86  }
87 
91  public function close()
92  {
93  return $this->handler->close();
94  }
95 
99  public function gc($maxlifetime)
100  {
101  return $this->handler->gc($maxlifetime);
102  }
103 }
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\open
open($savePath, $sessionName)
Definition: StrictSessionHandler.php:36
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\doWrite
doWrite($sessionId, $data)
Definition: StrictSessionHandler.php:62
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\doDestroy
doDestroy($sessionId)
Definition: StrictSessionHandler.php:81
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\gc
gc($maxlifetime)
Definition: StrictSessionHandler.php:99
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\destroy
destroy($sessionId)
Definition: StrictSessionHandler.php:70
Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler\write
write($sessionId, $data)
Definition: AbstractSessionHandler.php:112
Symfony\Component\HttpFoundation\Session\Storage\Handler
Definition: lib/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php:12
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\updateTimestamp
updateTimestamp($sessionId, $data)
Definition: StrictSessionHandler.php:54
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\doRead
doRead($sessionId)
Definition: StrictSessionHandler.php:46
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\__construct
__construct(\SessionHandlerInterface $handler)
Definition: StrictSessionHandler.php:24
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler\close
close()
Definition: StrictSessionHandler.php:91
Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler
Definition: AbstractSessionHandler.php:23
Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler
Definition: StrictSessionHandler.php:19