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

PhpFileLoader.php

Zuletzt modifiziert: 02.04.2025, 15:03 - Dateigröße: 1.95 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;
13   
14  use Symfony\Component\Config\Loader\FileLoader;
15  use Symfony\Component\Config\Resource\FileResource;
16  use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
17  use Symfony\Component\Routing\RouteCollection;
18   
19  /**
20   * PhpFileLoader loads routes from a PHP file.
21   *
22   * The file must return a RouteCollection instance.
23   *
24   * @author Fabien Potencier <fabien@symfony.com>
25   */
26  class PhpFileLoader extends FileLoader
27  {
28      /**
29       * Loads a PHP file.
30       *
31       * @param string      $file A PHP file path
32       * @param string|null $type The resource type
33       *
34       * @return RouteCollection A RouteCollection instance
35       */
36      public function load($file, $type = null)
37      {
38          $path = $this->locator->locate($file);
39          $this->setCurrentDir(\dirname($path));
40   
41          // the closure forbids access to the private scope in the included file
42          $loader = $this;
43          $load = \Closure::bind(static function ($file) use ($loader) {
44              return include $file;
45          }, null, ProtectedPhpFileLoader::class);
46   
47          $result = $load($path);
48   
49          if ($result instanceof \Closure) {
50              $collection = new RouteCollection();
51              $result(new RoutingConfigurator($collection, $this, $path, $file));
52          } else {
53              $collection = $result;
54          }
55   
56          $collection->addResource(new FileResource($path));
57   
58          return $collection;
59      }
60   
61      /**
62       * {@inheritdoc}
63       */
64      public function supports($resource, $type = null)
65      {
66          return \is_string($resource) && 'php' === pathinfo($resource, \PATHINFO_EXTENSION) && (!$type || 'php' === $type);
67      }
68  }
69   
70  /**
71   * @internal
72   */
73  final class ProtectedPhpFileLoader extends PhpFileLoader
74  {
75  }
76