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

DefinitionDecorator.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 5.18 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\DependencyInjection;
 013   
 014  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
 015  use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
 016   
 017  /**
 018   * This definition decorates another definition.
 019   *
 020   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
 021   */
 022  class DefinitionDecorator extends Definition
 023  {
 024      private $parent;
 025      private $changes = array();
 026   
 027      /**
 028       * @param string $parent The id of Definition instance to decorate
 029       */
 030      public function __construct($parent)
 031      {
 032          parent::__construct();
 033   
 034          $this->parent = $parent;
 035      }
 036   
 037      /**
 038       * Returns the Definition being decorated.
 039       *
 040       * @return string
 041       */
 042      public function getParent()
 043      {
 044          return $this->parent;
 045      }
 046   
 047      /**
 048       * Returns all changes tracked for the Definition object.
 049       *
 050       * @return array An array of changes for this Definition
 051       */
 052      public function getChanges()
 053      {
 054          return $this->changes;
 055      }
 056   
 057      /**
 058       * {@inheritdoc}
 059       */
 060      public function setClass($class)
 061      {
 062          $this->changes['class'] = true;
 063   
 064          return parent::setClass($class);
 065      }
 066   
 067      /**
 068       * {@inheritdoc}
 069       */
 070      public function setFactory($callable)
 071      {
 072          $this->changes['factory'] = true;
 073   
 074          return parent::setFactory($callable);
 075      }
 076   
 077      /**
 078       * {@inheritdoc}
 079       */
 080      public function setFactoryClass($class)
 081      {
 082          $this->changes['factory_class'] = true;
 083   
 084          return parent::setFactoryClass($class);
 085      }
 086   
 087      /**
 088       * {@inheritdoc}
 089       */
 090      public function setFactoryMethod($method)
 091      {
 092          $this->changes['factory_method'] = true;
 093   
 094          return parent::setFactoryMethod($method);
 095      }
 096   
 097      /**
 098       * {@inheritdoc}
 099       */
 100      public function setFactoryService($service, $triggerDeprecationError = true)
 101      {
 102          $this->changes['factory_service'] = true;
 103   
 104          return parent::setFactoryService($service, $triggerDeprecationError);
 105      }
 106   
 107      /**
 108       * {@inheritdoc}
 109       */
 110      public function setConfigurator($callable)
 111      {
 112          $this->changes['configurator'] = true;
 113   
 114          return parent::setConfigurator($callable);
 115      }
 116   
 117      /**
 118       * {@inheritdoc}
 119       */
 120      public function setFile($file)
 121      {
 122          $this->changes['file'] = true;
 123   
 124          return parent::setFile($file);
 125      }
 126   
 127      /**
 128       * {@inheritdoc}
 129       */
 130      public function setPublic($boolean)
 131      {
 132          $this->changes['public'] = true;
 133   
 134          return parent::setPublic($boolean);
 135      }
 136   
 137      /**
 138       * {@inheritdoc}
 139       */
 140      public function setLazy($boolean)
 141      {
 142          $this->changes['lazy'] = true;
 143   
 144          return parent::setLazy($boolean);
 145      }
 146   
 147      /**
 148       * {@inheritdoc}
 149       */
 150      public function setDecoratedService($id, $renamedId = null, $priority = 0)
 151      {
 152          $this->changes['decorated_service'] = true;
 153   
 154          return parent::setDecoratedService($id, $renamedId, $priority);
 155      }
 156   
 157      /**
 158       * {@inheritdoc}
 159       */
 160      public function setDeprecated($boolean = true, $template = null)
 161      {
 162          $this->changes['deprecated'] = true;
 163   
 164          return parent::setDeprecated($boolean, $template);
 165      }
 166   
 167      /**
 168       * {@inheritdoc}
 169       */
 170      public function setAutowired($autowired)
 171      {
 172          $this->changes['autowire'] = true;
 173   
 174          return parent::setAutowired($autowired);
 175      }
 176   
 177      /**
 178       * Gets an argument to pass to the service constructor/factory method.
 179       *
 180       * If replaceArgument() has been used to replace an argument, this method
 181       * will return the replacement value.
 182       *
 183       * @param int $index
 184       *
 185       * @return mixed The argument value
 186       *
 187       * @throws OutOfBoundsException When the argument does not exist
 188       */
 189      public function getArgument($index)
 190      {
 191          if (array_key_exists('index_'.$index, $this->arguments)) {
 192              return $this->arguments['index_'.$index];
 193          }
 194   
 195          $lastIndex = count(array_filter(array_keys($this->arguments), 'is_int')) - 1;
 196   
 197          if ($index < 0 || $index > $lastIndex) {
 198              throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, $lastIndex));
 199          }
 200   
 201          return $this->arguments[$index];
 202      }
 203   
 204      /**
 205       * You should always use this method when overwriting existing arguments
 206       * of the parent definition.
 207       *
 208       * If you directly call setArguments() keep in mind that you must follow
 209       * certain conventions when you want to overwrite the arguments of the
 210       * parent definition, otherwise your arguments will only be appended.
 211       *
 212       * @param int   $index
 213       * @param mixed $value
 214       *
 215       * @return DefinitionDecorator the current instance
 216       *
 217       * @throws InvalidArgumentException when $index isn't an integer
 218       */
 219      public function replaceArgument($index, $value)
 220      {
 221          if (!is_int($index)) {
 222              throw new InvalidArgumentException('$index must be an integer.');
 223          }
 224   
 225          $this->arguments['index_'.$index] = $value;
 226   
 227          return $this;
 228      }
 229  }
 230