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