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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Session.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 5.29 KiB


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;
013   
014  use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
015  use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
016  use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
017  use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
018  use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
019  use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
020   
021  /**
022   * Session.
023   *
024   * @author Fabien Potencier <fabien@symfony.com>
025   * @author Drak <drak@zikula.org>
026   */
027  class Session implements SessionInterface, \IteratorAggregate, \Countable
028  {
029      /**
030       * Storage driver.
031       *
032       * @var SessionStorageInterface
033       */
034      protected $storage;
035   
036      /**
037       * @var string
038       */
039      private $flashName;
040   
041      /**
042       * @var string
043       */
044      private $attributeName;
045   
046      /**
047       * Constructor.
048       *
049       * @param SessionStorageInterface $storage    A SessionStorageInterface instance
050       * @param AttributeBagInterface   $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
051       * @param FlashBagInterface       $flashes    A FlashBagInterface instance (defaults null for default FlashBag)
052       */
053      public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null)
054      {
055          $this->storage = $storage ?: new NativeSessionStorage();
056   
057          $attributes = $attributes ?: new AttributeBag();
058          $this->attributeName = $attributes->getName();
059          $this->registerBag($attributes);
060   
061          $flashes = $flashes ?: new FlashBag();
062          $this->flashName = $flashes->getName();
063          $this->registerBag($flashes);
064      }
065   
066      /**
067       * {@inheritdoc}
068       */
069      public function start()
070      {
071          return $this->storage->start();
072      }
073   
074      /**
075       * {@inheritdoc}
076       */
077      public function has($name)
078      {
079          return $this->storage->getBag($this->attributeName)->has($name);
080      }
081   
082      /**
083       * {@inheritdoc}
084       */
085      public function get($name, $default = null)
086      {
087          return $this->storage->getBag($this->attributeName)->get($name, $default);
088      }
089   
090      /**
091       * {@inheritdoc}
092       */
093      public function set($name, $value)
094      {
095          $this->storage->getBag($this->attributeName)->set($name, $value);
096      }
097   
098      /**
099       * {@inheritdoc}
100       */
101      public function all()
102      {
103          return $this->storage->getBag($this->attributeName)->all();
104      }
105   
106      /**
107       * {@inheritdoc}
108       */
109      public function replace(array $attributes)
110      {
111          $this->storage->getBag($this->attributeName)->replace($attributes);
112      }
113   
114      /**
115       * {@inheritdoc}
116       */
117      public function remove($name)
118      {
119          return $this->storage->getBag($this->attributeName)->remove($name);
120      }
121   
122      /**
123       * {@inheritdoc}
124       */
125      public function clear()
126      {
127          $this->storage->getBag($this->attributeName)->clear();
128      }
129   
130      /**
131       * {@inheritdoc}
132       */
133      public function isStarted()
134      {
135          return $this->storage->isStarted();
136      }
137   
138      /**
139       * Returns an iterator for attributes.
140       *
141       * @return \ArrayIterator An \ArrayIterator instance
142       */
143      public function getIterator()
144      {
145          return new \ArrayIterator($this->storage->getBag($this->attributeName)->all());
146      }
147   
148      /**
149       * Returns the number of attributes.
150       *
151       * @return int The number of attributes
152       */
153      public function count()
154      {
155          return count($this->storage->getBag($this->attributeName)->all());
156      }
157   
158      /**
159       * {@inheritdoc}
160       */
161      public function invalidate($lifetime = null)
162      {
163          $this->storage->clear();
164   
165          return $this->migrate(true, $lifetime);
166      }
167   
168      /**
169       * {@inheritdoc}
170       */
171      public function migrate($destroy = false, $lifetime = null)
172      {
173          return $this->storage->regenerate($destroy, $lifetime);
174      }
175   
176      /**
177       * {@inheritdoc}
178       */
179      public function save()
180      {
181          $this->storage->save();
182      }
183   
184      /**
185       * {@inheritdoc}
186       */
187      public function getId()
188      {
189          return $this->storage->getId();
190      }
191   
192      /**
193       * {@inheritdoc}
194       */
195      public function setId($id)
196      {
197          $this->storage->setId($id);
198      }
199   
200      /**
201       * {@inheritdoc}
202       */
203      public function getName()
204      {
205          return $this->storage->getName();
206      }
207   
208      /**
209       * {@inheritdoc}
210       */
211      public function setName($name)
212      {
213          $this->storage->setName($name);
214      }
215   
216      /**
217       * {@inheritdoc}
218       */
219      public function getMetadataBag()
220      {
221          return $this->storage->getMetadataBag();
222      }
223   
224      /**
225       * {@inheritdoc}
226       */
227      public function registerBag(SessionBagInterface $bag)
228      {
229          $this->storage->registerBag($bag);
230      }
231   
232      /**
233       * {@inheritdoc}
234       */
235      public function getBag($name)
236      {
237          return $this->storage->getBag($name);
238      }
239   
240      /**
241       * Gets the flashbag interface.
242       *
243       * @return FlashBagInterface
244       */
245      public function getFlashBag()
246      {
247          return $this->getBag($this->flashName);
248      }
249  }
250