PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.12.1
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.12.1
5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / http-foundation / Session / Flash / FlashBag.php
matomo / app / vendor / prefixed / symfony / http-foundation / Session / Flash Last commit date
AutoExpireFlashBag.php 2 years ago FlashBag.php 2 years ago FlashBagInterface.php 2 years ago
FlashBag.php
133 lines
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 namespace Matomo\Dependencies\Symfony\Component\HttpFoundation\Session\Flash;
12
13 /**
14 * FlashBag flash message container.
15 *
16 * @author Drak <drak@zikula.org>
17 */
18 class FlashBag implements FlashBagInterface
19 {
20 private $name = 'flashes';
21 private $flashes = [];
22 private $storageKey;
23 /**
24 * @param string $storageKey The key used to store flashes in the session
25 */
26 public function __construct(string $storageKey = '_symfony_flashes')
27 {
28 $this->storageKey = $storageKey;
29 }
30 /**
31 * {@inheritdoc}
32 */
33 public function getName()
34 {
35 return $this->name;
36 }
37 public function setName(string $name)
38 {
39 $this->name = $name;
40 }
41 /**
42 * {@inheritdoc}
43 */
44 public function initialize(array &$flashes)
45 {
46 $this->flashes =& $flashes;
47 }
48 /**
49 * {@inheritdoc}
50 */
51 public function add(string $type, $message)
52 {
53 $this->flashes[$type][] = $message;
54 }
55 /**
56 * {@inheritdoc}
57 */
58 public function peek(string $type, array $default = [])
59 {
60 return $this->has($type) ? $this->flashes[$type] : $default;
61 }
62 /**
63 * {@inheritdoc}
64 */
65 public function peekAll()
66 {
67 return $this->flashes;
68 }
69 /**
70 * {@inheritdoc}
71 */
72 public function get(string $type, array $default = [])
73 {
74 if (!$this->has($type)) {
75 return $default;
76 }
77 $return = $this->flashes[$type];
78 unset($this->flashes[$type]);
79 return $return;
80 }
81 /**
82 * {@inheritdoc}
83 */
84 public function all()
85 {
86 $return = $this->peekAll();
87 $this->flashes = [];
88 return $return;
89 }
90 /**
91 * {@inheritdoc}
92 */
93 public function set(string $type, $messages)
94 {
95 $this->flashes[$type] = (array) $messages;
96 }
97 /**
98 * {@inheritdoc}
99 */
100 public function setAll(array $messages)
101 {
102 $this->flashes = $messages;
103 }
104 /**
105 * {@inheritdoc}
106 */
107 public function has(string $type)
108 {
109 return \array_key_exists($type, $this->flashes) && $this->flashes[$type];
110 }
111 /**
112 * {@inheritdoc}
113 */
114 public function keys()
115 {
116 return array_keys($this->flashes);
117 }
118 /**
119 * {@inheritdoc}
120 */
121 public function getStorageKey()
122 {
123 return $this->storageKey;
124 }
125 /**
126 * {@inheritdoc}
127 */
128 public function clear()
129 {
130 return $this->all();
131 }
132 }
133