PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.15.1
GiveWP – Donation Plugin and Fundraising Platform v4.15.1
4.18.0.1 4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 All 258 releases
give / vendor / vendor-prefixed / symfony / http-foundation / Session / SessionBagProxy.php

SessionBagProxy.php in GiveWP – Donation Plugin and Fundraising Platform 4.15.1, at vendor/vendor-prefixed/symfony/http-foundation/Session/SessionBagProxy.php

96 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <[email protected]>
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 Give\Vendors\Symfony\Component\HttpFoundation\Session;
13
14 /**
15 * @author Nicolas Grekas <[email protected]>
16 *
17 * @internal
18 */
19 final class SessionBagProxy implements SessionBagInterface
20 {
21 private $bag;
22 private $data;
23 private $usageIndex;
24 private $usageReporter;
25
26 public function __construct(SessionBagInterface $bag, array &$data, ?int &$usageIndex, ?callable $usageReporter)
27 {
28 $this->bag = $bag;
29 $this->data = &$data;
30 $this->usageIndex = &$usageIndex;
31 $this->usageReporter = $usageReporter;
32 }
33
34 public function getBag(): SessionBagInterface
35 {
36 ++$this->usageIndex;
37 if ($this->usageReporter && 0 <= $this->usageIndex) {
38 ($this->usageReporter)();
39 }
40
41 return $this->bag;
42 }
43
44 public function isEmpty(): bool
45 {
46 if (!isset($this->data[$this->bag->getStorageKey()])) {
47 return true;
48 }
49 ++$this->usageIndex;
50 if ($this->usageReporter && 0 <= $this->usageIndex) {
51 ($this->usageReporter)();
52 }
53
54 return empty($this->data[$this->bag->getStorageKey()]);
55 }
56
57 /**
58 * {@inheritdoc}
59 */
60 public function getName(): string
61 {
62 return $this->bag->getName();
63 }
64
65 /**
66 * {@inheritdoc}
67 */
68 public function initialize(array &$array): void
69 {
70 ++$this->usageIndex;
71 if ($this->usageReporter && 0 <= $this->usageIndex) {
72 ($this->usageReporter)();
73 }
74
75 $this->data[$this->bag->getStorageKey()] = &$array;
76
77 $this->bag->initialize($array);
78 }
79
80 /**
81 * {@inheritdoc}
82 */
83 public function getStorageKey(): string
84 {
85 return $this->bag->getStorageKey();
86 }
87
88 /**
89 * {@inheritdoc}
90 */
91 public function clear()
92 {
93 return $this->bag->clear();
94 }
95 }
96