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

AttributeBag.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.93 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   
 021      /**
 022       * @var string
 023       */
 024      private $storageKey;
 025   
 026      /**
 027       * @var array
 028       */
 029      protected $attributes = array();
 030   
 031      /**
 032       * Constructor.
 033       *
 034       * @param string $storageKey The key used to store attributes in the session
 035       */
 036      public function __construct($storageKey = '_sf2_attributes')
 037      {
 038          $this->storageKey = $storageKey;
 039      }
 040   
 041      /**
 042       * {@inheritdoc}
 043       */
 044      public function getName()
 045      {
 046          return $this->name;
 047      }
 048   
 049      public function setName($name)
 050      {
 051          $this->name = $name;
 052      }
 053   
 054      /**
 055       * {@inheritdoc}
 056       */
 057      public function initialize(array &$attributes)
 058      {
 059          $this->attributes = &$attributes;
 060      }
 061   
 062      /**
 063       * {@inheritdoc}
 064       */
 065      public function getStorageKey()
 066      {
 067          return $this->storageKey;
 068      }
 069   
 070      /**
 071       * {@inheritdoc}
 072       */
 073      public function has($name)
 074      {
 075          return array_key_exists($name, $this->attributes);
 076      }
 077   
 078      /**
 079       * {@inheritdoc}
 080       */
 081      public function get($name, $default = null)
 082      {
 083          return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
 084      }
 085   
 086      /**
 087       * {@inheritdoc}
 088       */
 089      public function set($name, $value)
 090      {
 091          $this->attributes[$name] = $value;
 092      }
 093   
 094      /**
 095       * {@inheritdoc}
 096       */
 097      public function all()
 098      {
 099          return $this->attributes;
 100      }
 101   
 102      /**
 103       * {@inheritdoc}
 104       */
 105      public function replace(array $attributes)
 106      {
 107          $this->attributes = array();
 108          foreach ($attributes as $key => $value) {
 109              $this->set($key, $value);
 110          }
 111      }
 112   
 113      /**
 114       * {@inheritdoc}
 115       */
 116      public function remove($name)
 117      {
 118          $retval = null;
 119          if (array_key_exists($name, $this->attributes)) {
 120              $retval = $this->attributes[$name];
 121              unset($this->attributes[$name]);
 122          }
 123   
 124          return $retval;
 125      }
 126   
 127      /**
 128       * {@inheritdoc}
 129       */
 130      public function clear()
 131      {
 132          $return = $this->attributes;
 133          $this->attributes = array();
 134   
 135          return $return;
 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->attributes);
 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->attributes);
 156      }
 157  }
 158