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

SplFileInfo.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 1.83 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\Finder;
13   
14  /**
15   * Extends \SplFileInfo to support relative paths.
16   *
17   * @author Fabien Potencier <fabien@symfony.com>
18   */
19  class SplFileInfo extends \SplFileInfo
20  {
21      private $relativePath;
22      private $relativePathname;
23   
24      /**
25       * @param string $file             The file name
26       * @param string $relativePath     The relative path
27       * @param string $relativePathname The relative path name
28       */
29      public function __construct($file, $relativePath, $relativePathname)
30      {
31          parent::__construct($file);
32          $this->relativePath = $relativePath;
33          $this->relativePathname = $relativePathname;
34      }
35   
36      /**
37       * Returns the relative path.
38       *
39       * This path does not contain the file name.
40       *
41       * @return string the relative path
42       */
43      public function getRelativePath()
44      {
45          return $this->relativePath;
46      }
47   
48      /**
49       * Returns the relative path name.
50       *
51       * This path contains the file name.
52       *
53       * @return string the relative path name
54       */
55      public function getRelativePathname()
56      {
57          return $this->relativePathname;
58      }
59   
60      /**
61       * Returns the contents of the file.
62       *
63       * @return string the contents of the file
64       *
65       * @throws \RuntimeException
66       */
67      public function getContents()
68      {
69          set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
70          $content = file_get_contents($this->getPathname());
71          restore_error_handler();
72          if (false === $content) {
73              throw new \RuntimeException($error);
74          }
75   
76          return $content;
77      }
78  }
79