Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
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 * @author Drak <drak@zikula.org>
018 */
019 class FlashBag implements FlashBagInterface, \IteratorAggregate
020 {
021 private $name = 'flashes';
022
023 /**
024 * Flash messages.
025 *
026 * @var array
027 */
028 private $flashes = array();
029
030 /**
031 * The storage key for flashes in the session
032 *
033 * @var string
034 */
035 private $storageKey;
036
037 /**
038 * Constructor.
039 *
040 * @param string $storageKey The key used to store flashes in the session.
041 */
042 public function __construct($storageKey = '_sf2_flashes')
043 {
044 $this->storageKey = $storageKey;
045 }
046
047 /**
048 * {@inheritdoc}
049 */
050 public function getName()
051 {
052 return $this->name;
053 }
054
055 public function setName($name)
056 {
057 $this->name = $name;
058 }
059
060 /**
061 * {@inheritdoc}
062 */
063 public function initialize(array &$flashes)
064 {
065 $this->flashes = &$flashes;
066 }
067
068 /**
069 * {@inheritdoc}
070 */
071 public function add($type, $message)
072 {
073 $this->flashes[$type][] = $message;
074 }
075
076 /**
077 * {@inheritdoc}
078 */
079 public function peek($type, array $default = array())
080 {
081 return $this->has($type) ? $this->flashes[$type] : $default;
082 }
083
084 /**
085 * {@inheritdoc}
086 */
087 public function peekAll()
088 {
089 return $this->flashes;
090 }
091
092 /**
093 * {@inheritdoc}
094 */
095 public function get($type, array $default = array())
096 {
097 if (!$this->has($type)) {
098 return $default;
099 }
100
101 $return = $this->flashes[$type];
102
103 unset($this->flashes[$type]);
104
105 return $return;
106 }
107
108 /**
109 * {@inheritdoc}
110 */
111 public function all()
112 {
113 $return = $this->peekAll();
114 $this->flashes = array();
115
116 return $return;
117 }
118
119 /**
120 * {@inheritdoc}
121 */
122 public function set($type, $messages)
123 {
124 $this->flashes[$type] = (array) $messages;
125 }
126
127 /**
128 * {@inheritdoc}
129 */
130 public function setAll(array $messages)
131 {
132 $this->flashes = $messages;
133 }
134
135 /**
136 * {@inheritdoc}
137 */
138 public function has($type)
139 {
140 return array_key_exists($type, $this->flashes) && $this->flashes[$type];
141 }
142
143 /**
144 * {@inheritdoc}
145 */
146 public function keys()
147 {
148 return array_keys($this->flashes);
149 }
150
151 /**
152 * {@inheritdoc}
153 */
154 public function getStorageKey()
155 {
156 return $this->storageKey;
157 }
158
159 /**
160 * {@inheritdoc}
161 */
162 public function clear()
163 {
164 return $this->all();
165 }
166
167 /**
168 * Returns an iterator for flashes.
169 *
170 * @return \ArrayIterator An \ArrayIterator instance
171 */
172 public function getIterator()
173 {
174 return new \ArrayIterator($this->all());
175 }
176 }
177