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

CollectionConfigurator.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.89 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\Routing\Loader\Configurator;
13   
14  use Symfony\Component\Routing\Route;
15  use Symfony\Component\Routing\RouteCollection;
16   
17  /**
18   * @author Nicolas Grekas <p@tchwork.com>
19   */
20  class CollectionConfigurator
21  {
22      use Traits\AddTrait;
23      use Traits\RouteTrait;
24   
25      private $parent;
26      private $parentConfigurator;
27   
28      public function __construct(RouteCollection $parent, $name, self $parentConfigurator = null)
29      {
30          $this->parent = $parent;
31          $this->name = $name;
32          $this->collection = new RouteCollection();
33          $this->route = new Route('');
34          $this->parentConfigurator = $parentConfigurator; // for GC control
35      }
36   
37      public function __destruct()
38      {
39          $this->collection->addPrefix(rtrim($this->route->getPath(), '/'));
40          $this->parent->addCollection($this->collection);
41      }
42   
43      /**
44       * Adds a route.
45       *
46       * @param string $name
47       * @param string $path
48       *
49       * @return RouteConfigurator
50       */
51      final public function add($name, $path)
52      {
53          $this->collection->add($this->name.$name, $route = clone $this->route);
54   
55          return new RouteConfigurator($this->collection, $route->setPath($path), $this->name, $this);
56      }
57   
58      /**
59       * Creates a sub-collection.
60       *
61       * @return self
62       */
63      final public function collection($name = '')
64      {
65          return new self($this->collection, $this->name.$name, $this);
66      }
67   
68      /**
69       * Sets the prefix to add to the path of all child routes.
70       *
71       * @param string $prefix
72       *
73       * @return $this
74       */
75      final public function prefix($prefix)
76      {
77          $this->route->setPath($prefix);
78   
79          return $this;
80      }
81  }
82