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

ChildDefinition.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 3.27 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\BadMethodCallException;
015  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
016  use Symfony\Component\DependencyInjection\Exception\OutOfBoundsException;
017   
018  /**
019   * This definition extends another definition.
020   *
021   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
022   */
023  class ChildDefinition extends Definition
024  {
025      private $parent;
026   
027      /**
028       * @param string $parent The id of Definition instance to decorate
029       */
030      public function __construct($parent)
031      {
032          $this->parent = $parent;
033          $this->setPrivate(false);
034      }
035   
036      /**
037       * Returns the Definition to inherit from.
038       *
039       * @return string
040       */
041      public function getParent()
042      {
043          return $this->parent;
044      }
045   
046      /**
047       * Sets the Definition to inherit from.
048       *
049       * @param string $parent
050       *
051       * @return $this
052       */
053      public function setParent($parent)
054      {
055          $this->parent = $parent;
056   
057          return $this;
058      }
059   
060      /**
061       * Gets an argument to pass to the service constructor/factory method.
062       *
063       * If replaceArgument() has been used to replace an argument, this method
064       * will return the replacement value.
065       *
066       * @param int|string $index
067       *
068       * @return mixed The argument value
069       *
070       * @throws OutOfBoundsException When the argument does not exist
071       */
072      public function getArgument($index)
073      {
074          if (\array_key_exists('index_'.$index, $this->arguments)) {
075              return $this->arguments['index_'.$index];
076          }
077   
078          return parent::getArgument($index);
079      }
080   
081      /**
082       * You should always use this method when overwriting existing arguments
083       * of the parent definition.
084       *
085       * If you directly call setArguments() keep in mind that you must follow
086       * certain conventions when you want to overwrite the arguments of the
087       * parent definition, otherwise your arguments will only be appended.
088       *
089       * @param int|string $index
090       * @param mixed      $value
091       *
092       * @return $this
093       *
094       * @throws InvalidArgumentException when $index isn't an integer
095       */
096      public function replaceArgument($index, $value)
097      {
098          if (\is_int($index)) {
099              $this->arguments['index_'.$index] = $value;
100          } elseif (0 === strpos($index, '$')) {
101              $this->arguments[$index] = $value;
102          } else {
103              throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.');
104          }
105   
106          return $this;
107      }
108   
109      /**
110       * @internal
111       */
112      public function setAutoconfigured($autoconfigured)
113      {
114          throw new BadMethodCallException('A ChildDefinition cannot be autoconfigured.');
115      }
116   
117      /**
118       * @internal
119       */
120      public function setInstanceofConditionals(array $instanceof)
121      {
122          throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.');
123      }
124  }
125   
126  class_alias(ChildDefinition::class, DefinitionDecorator::class);
127