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

ParentTrait.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.93 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Component\DependencyInjection\Loader\Configurator\Traits;
13   
14  use Symfony\Component\DependencyInjection\ChildDefinition;
15  use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
16   
17  /**
18   * @method $this parent(string $parent)
19   */
20  trait ParentTrait
21  {
22      /**
23       * Sets the Definition to inherit from.
24       *
25       * @param string $parent
26       *
27       * @return $this
28       *
29       * @throws InvalidArgumentException when parent cannot be set
30       */
31      final protected function setParent($parent)
32      {
33          if (!$this->allowParent) {
34              throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
35          }
36   
37          if ($this->definition instanceof ChildDefinition) {
38              $this->definition->setParent($parent);
39          } elseif ($this->definition->isAutoconfigured()) {
40              throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id));
41          } elseif ($this->definition->getBindings()) {
42              throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also "bind" arguments.', $this->id));
43          } else {
44              // cast Definition to ChildDefinition
45              $definition = serialize($this->definition);
46              $definition = substr_replace($definition, '53', 2, 2);
47              $definition = substr_replace($definition, 'Child', 44, 0);
48              $definition = unserialize($definition);
49   
50              $this->definition = $definition->setParent($parent);
51          }
52   
53          return $this;
54      }
55  }
56