Open Journal Systems  3.3.0
SessionBagProxy.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 
19 final class SessionBagProxy implements SessionBagInterface
20 {
21  private $bag;
22  private $data;
23  private $usageIndex;
24 
25  public function __construct(SessionBagInterface $bag, array &$data, ?int &$usageIndex)
26  {
27  $this->bag = $bag;
28  $this->data = &$data;
29  $this->usageIndex = &$usageIndex;
30  }
31 
32  public function getBag(): SessionBagInterface
33  {
34  ++$this->usageIndex;
35 
36  return $this->bag;
37  }
38 
39  public function isEmpty(): bool
40  {
41  if (!isset($this->data[$this->bag->getStorageKey()])) {
42  return true;
43  }
44  ++$this->usageIndex;
45 
46  return empty($this->data[$this->bag->getStorageKey()]);
47  }
48 
52  public function getName(): string
53  {
54  return $this->bag->getName();
55  }
56 
60  public function initialize(array &$array): void
61  {
62  ++$this->usageIndex;
63  $this->data[$this->bag->getStorageKey()] = &$array;
64 
65  $this->bag->initialize($array);
66  }
67 
71  public function getStorageKey(): string
72  {
73  return $this->bag->getStorageKey();
74  }
75 
79  public function clear()
80  {
81  return $this->bag->clear();
82  }
83 }
Symfony\Component\HttpFoundation\Session\SessionBagProxy\isEmpty
isEmpty()
Definition: SessionBagProxy.php:39
Symfony\Component\HttpFoundation\Session
Symfony\Component\HttpFoundation\Session\SessionBagProxy\clear
clear()
Definition: SessionBagProxy.php:79
Symfony\Component\HttpFoundation\Session\SessionBagProxy\initialize
initialize(array &$array)
Definition: SessionBagProxy.php:60
Symfony\Component\HttpFoundation\Session\SessionBagProxy\getBag
getBag()
Definition: SessionBagProxy.php:32
Symfony\Component\HttpFoundation\Session\SessionBagProxy
Definition: SessionBagProxy.php:19
Symfony\Component\HttpFoundation\Session\SessionBagInterface
Definition: lib/vendor/symfony/http-foundation/Session/SessionBagInterface.php:19
Symfony\Component\HttpFoundation\Session\SessionBagProxy\getName
getName()
Definition: SessionBagProxy.php:52
Symfony\Component\HttpFoundation\Session\SessionBagProxy\__construct
__construct(SessionBagInterface $bag, array &$data, ?int &$usageIndex)
Definition: SessionBagProxy.php:25
Symfony\Component\HttpFoundation\Session\SessionBagProxy\getStorageKey
getStorageKey()
Definition: SessionBagProxy.php:71