Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

GenericEvent.php

Zuletzt modifiziert: 01.05.2026, 11:26 - Dateigröße: 3.61 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\EventDispatcher;
 013   
 014  /**
 015   * Event encapsulation class.
 016   *
 017   * Encapsulates events thus decoupling the observer from the subject they encapsulate.
 018   *
 019   * @author Drak <drak@zikula.org>
 020   */
 021  class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
 022  {
 023      protected $subject;
 024      protected $arguments;
 025   
 026      /**
 027       * Encapsulate an event with $subject and $args.
 028       *
 029       * @param mixed $subject   The subject of the event, usually an object or a callable
 030       * @param array $arguments Arguments to store in the event
 031       */
 032      public function __construct($subject = null, array $arguments = [])
 033      {
 034          $this->subject = $subject;
 035          $this->arguments = $arguments;
 036      }
 037   
 038      /**
 039       * Getter for subject property.
 040       *
 041       * @return mixed The observer subject
 042       */
 043      public function getSubject()
 044      {
 045          return $this->subject;
 046      }
 047   
 048      /**
 049       * Get argument by key.
 050       *
 051       * @param string $key Key
 052       *
 053       * @return mixed Contents of array key
 054       *
 055       * @throws \InvalidArgumentException if key is not found
 056       */
 057      public function getArgument($key)
 058      {
 059          if ($this->hasArgument($key)) {
 060              return $this->arguments[$key];
 061          }
 062   
 063          throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
 064      }
 065   
 066      /**
 067       * Add argument to event.
 068       *
 069       * @param string $key   Argument name
 070       * @param mixed  $value Value
 071       *
 072       * @return $this
 073       */
 074      public function setArgument($key, $value)
 075      {
 076          $this->arguments[$key] = $value;
 077   
 078          return $this;
 079      }
 080   
 081      /**
 082       * Getter for all arguments.
 083       *
 084       * @return array
 085       */
 086      public function getArguments()
 087      {
 088          return $this->arguments;
 089      }
 090   
 091      /**
 092       * Set args property.
 093       *
 094       * @param array $args Arguments
 095       *
 096       * @return $this
 097       */
 098      public function setArguments(array $args = [])
 099      {
 100          $this->arguments = $args;
 101   
 102          return $this;
 103      }
 104   
 105      /**
 106       * Has argument.
 107       *
 108       * @param string $key Key of arguments array
 109       *
 110       * @return bool
 111       */
 112      public function hasArgument($key)
 113      {
 114          return \array_key_exists($key, $this->arguments);
 115      }
 116   
 117      /**
 118       * ArrayAccess for argument getter.
 119       *
 120       * @param string $key Array key
 121       *
 122       * @return mixed
 123       *
 124       * @throws \InvalidArgumentException if key does not exist in $this->args
 125       */
 126      public function offsetGet($key)
 127      {
 128          return $this->getArgument($key);
 129      }
 130   
 131      /**
 132       * ArrayAccess for argument setter.
 133       *
 134       * @param string $key   Array key to set
 135       * @param mixed  $value Value
 136       */
 137      public function offsetSet($key, $value)
 138      {
 139          $this->setArgument($key, $value);
 140      }
 141   
 142      /**
 143       * ArrayAccess for unset argument.
 144       *
 145       * @param string $key Array key
 146       */
 147      public function offsetUnset($key)
 148      {
 149          if ($this->hasArgument($key)) {
 150              unset($this->arguments[$key]);
 151          }
 152      }
 153   
 154      /**
 155       * ArrayAccess has argument.
 156       *
 157       * @param string $key Array key
 158       *
 159       * @return bool
 160       */
 161      public function offsetExists($key)
 162      {
 163          return $this->hasArgument($key);
 164      }
 165   
 166      /**
 167       * IteratorAggregate for iterating over the object like an array.
 168       *
 169       * @return \ArrayIterator
 170       */
 171      public function getIterator()
 172      {
 173          return new \ArrayIterator($this->arguments);
 174      }
 175  }
 176