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

TreeBuilder.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.70 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\Config\Definition\Builder;
13   
14  use Symfony\Component\Config\Definition\NodeInterface;
15   
16  /**
17   * This is the entry class for building a config tree.
18   *
19   * @author Johannes M. Schmitt <schmittjoh@gmail.com>
20   */
21  class TreeBuilder implements NodeParentInterface
22  {
23      protected $tree;
24      protected $root;
25   
26      /**
27       * @deprecated since 3.4. To be removed in 4.0
28       */
29      protected $builder;
30   
31      /**
32       * Creates the root node.
33       *
34       * @param string      $name    The name of the root node
35       * @param string      $type    The type of the root node
36       * @param NodeBuilder $builder A custom node builder instance
37       *
38       * @return ArrayNodeDefinition|NodeDefinition The root node (as an ArrayNodeDefinition when the type is 'array')
39       *
40       * @throws \RuntimeException When the node type is not supported
41       */
42      public function root($name, $type = 'array', NodeBuilder $builder = null)
43      {
44          $builder = $builder ?: new NodeBuilder();
45   
46          return $this->root = $builder->node($name, $type)->setParent($this);
47      }
48   
49      /**
50       * Builds the tree.
51       *
52       * @return NodeInterface
53       *
54       * @throws \RuntimeException
55       */
56      public function buildTree()
57      {
58          if (null === $this->root) {
59              throw new \RuntimeException('The configuration tree has no root node.');
60          }
61          if (null !== $this->tree) {
62              return $this->tree;
63          }
64   
65          return $this->tree = $this->root->getNode(true);
66      }
67  }
68