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

DefinitionDecorator.php

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