Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
FlashBag.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\HttpFoundation\Session\Flash;
013
014 /**
015 * FlashBag flash message container.
016 *
017 * \IteratorAggregate implementation is deprecated and will be removed in 3.0.
018 *
019 * @author Drak <drak@zikula.org>
020 */
021 class FlashBag implements FlashBagInterface, \IteratorAggregate
022 {
023 private $name = 'flashes';
024
025 /**
026 * Flash messages.
027 *
028 * @var array
029 */
030 private $flashes = array();
031
032 /**
033 * The storage key for flashes in the session.
034 *
035 * @var string
036 */
037 private $storageKey;
038
039 /**
040 * Constructor.
041 *
042 * @param string $storageKey The key used to store flashes in the session
043 */
044 public function __construct($storageKey = '_sf2_flashes')
045 {
046 $this->storageKey = $storageKey;
047 }
048
049 /**
050 * {@inheritdoc}
051 */
052 public function getName()
053 {
054 return $this->name;
055 }
056
057 public function setName($name)
058 {
059 $this->name = $name;
060 }
061
062 /**
063 * {@inheritdoc}
064 */
065 public function initialize(array &$flashes)
066 {
067 $this->flashes = &$flashes;
068 }
069
070 /**
071 * {@inheritdoc}
072 */
073 public function add($type, $message)
074 {
075 $this->flashes[$type][] = $message;
076 }
077
078 /**
079 * {@inheritdoc}
080 */
081 public function peek($type, array $default = array())
082 {
083 return $this->has($type) ? $this->flashes[$type] : $default;
084 }
085
086 /**
087 * {@inheritdoc}
088 */
089 public function peekAll()
090 {
091 return $this->flashes;
092 }
093
094 /**
095 * {@inheritdoc}
096 */
097 public function get($type, array $default = array())
098 {
099 if (!$this->has($type)) {
100 return $default;
101 }
102
103 $return = $this->flashes[$type];
104
105 unset($this->flashes[$type]);
106
107 return $return;
108 }
109
110 /**
111 * {@inheritdoc}
112 */
113 public function all()
114 {
115 $return = $this->peekAll();
116 $this->flashes = array();
117
118 return $return;
119 }
120
121 /**
122 * {@inheritdoc}
123 */
124 public function set($type, $messages)
125 {
126 $this->flashes[$type] = (array) $messages;
127 }
128
129 /**
130 * {@inheritdoc}
131 */
132 public function setAll(array $messages)
133 {
134 $this->flashes = $messages;
135 }
136
137 /**
138 * {@inheritdoc}
139 */
140 public function has($type)
141 {
142 return array_key_exists($type, $this->flashes) && $this->flashes[$type];
143 }
144
145 /**
146 * {@inheritdoc}
147 */
148 public function keys()
149 {
150 return array_keys($this->flashes);
151 }
152
153 /**
154 * {@inheritdoc}
155 */
156 public function getStorageKey()
157 {
158 return $this->storageKey;
159 }
160
161 /**
162 * {@inheritdoc}
163 */
164 public function clear()
165 {
166 return $this->all();
167 }
168
169 /**
170 * Returns an iterator for flashes.
171 *
172 * @deprecated since version 2.4, to be removed in 3.0.
173 *
174 * @return \ArrayIterator An \ArrayIterator instance
175 */
176 public function getIterator()
177 {
178 @trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
179
180 return new \ArrayIterator($this->all());
181 }
182 }
183