Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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

AttributeBag.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 2.83 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\Attribute;
013   
014  /**
015   * This class relates to session attribute storage.
016   */
017  class AttributeBag implements AttributeBagInterface, \IteratorAggregate, \Countable
018  {
019      private $name = 'attributes';
020      private $storageKey;
021   
022      protected $attributes = [];
023   
024      /**
025       * @param string $storageKey The key used to store attributes in the session
026       */
027      public function __construct($storageKey = '_sf2_attributes')
028      {
029          $this->storageKey = $storageKey;
030      }
031   
032      /**
033       * {@inheritdoc}
034       */
035      public function getName()
036      {
037          return $this->name;
038      }
039   
040      public function setName($name)
041      {
042          $this->name = $name;
043      }
044   
045      /**
046       * {@inheritdoc}
047       */
048      public function initialize(array &$attributes)
049      {
050          $this->attributes = &$attributes;
051      }
052   
053      /**
054       * {@inheritdoc}
055       */
056      public function getStorageKey()
057      {
058          return $this->storageKey;
059      }
060   
061      /**
062       * {@inheritdoc}
063       */
064      public function has($name)
065      {
066          return \array_key_exists($name, $this->attributes);
067      }
068   
069      /**
070       * {@inheritdoc}
071       */
072      public function get($name, $default = null)
073      {
074          return \array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
075      }
076   
077      /**
078       * {@inheritdoc}
079       */
080      public function set($name, $value)
081      {
082          $this->attributes[$name] = $value;
083      }
084   
085      /**
086       * {@inheritdoc}
087       */
088      public function all()
089      {
090          return $this->attributes;
091      }
092   
093      /**
094       * {@inheritdoc}
095       */
096      public function replace(array $attributes)
097      {
098          $this->attributes = [];
099          foreach ($attributes as $key => $value) {
100              $this->set($key, $value);
101          }
102      }
103   
104      /**
105       * {@inheritdoc}
106       */
107      public function remove($name)
108      {
109          $retval = null;
110          if (\array_key_exists($name, $this->attributes)) {
111              $retval = $this->attributes[$name];
112              unset($this->attributes[$name]);
113          }
114   
115          return $retval;
116      }
117   
118      /**
119       * {@inheritdoc}
120       */
121      public function clear()
122      {
123          $return = $this->attributes;
124          $this->attributes = [];
125   
126          return $return;
127      }
128   
129      /**
130       * Returns an iterator for attributes.
131       *
132       * @return \ArrayIterator An \ArrayIterator instance
133       */
134      public function getIterator()
135      {
136          return new \ArrayIterator($this->attributes);
137      }
138   
139      /**
140       * Returns the number of attributes.
141       *
142       * @return int The number of attributes
143       */
144      public function count()
145      {
146          return \count($this->attributes);
147      }
148  }
149