Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
DirectoryLoader.php
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\Routing\RouteCollection;
16 use Symfony\Component\Config\Resource\DirectoryResource;
17
18 class DirectoryLoader extends FileLoader
19 {
20 /**
21 * {@inheritdoc}
22 */
23 public function load($file, $type = null)
24 {
25 $path = $this->locator->locate($file);
26
27 $collection = new RouteCollection();
28 $collection->addResource(new DirectoryResource($path));
29
30 foreach (scandir($path) as $dir) {
31 if ('.' !== $dir[0]) {
32 $this->setCurrentDir($path);
33 $subPath = $path.'/'.$dir;
34 $subType = null;
35
36 if (is_dir($subPath)) {
37 $subPath .= '/';
38 $subType = 'directory';
39 }
40
41 $subCollection = $this->import($subPath, $subType, false, $path);
42 $collection->addCollection($subCollection);
43 }
44 }
45
46 return $collection;
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 public function supports($resource, $type = null)
53 {
54 // only when type is forced to directory, not to conflict with AnnotationLoader
55
56 return 'directory' === $type;
57 }
58 }
59