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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
FileResource.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\Config\Resource;
13
14 /**
15 * FileResource represents a resource stored on the filesystem.
16 *
17 * The resource can be a file or a directory.
18 *
19 * @author Fabien Potencier <fabien@symfony.com>
20 */
21 class FileResource implements SelfCheckingResourceInterface, \Serializable
22 {
23 /**
24 * @var string|false
25 */
26 private $resource;
27
28 /**
29 * @param string $resource The file path to the resource
30 *
31 * @throws \InvalidArgumentException
32 */
33 public function __construct($resource)
34 {
35 $this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
36
37 if (false === $this->resource) {
38 throw new \InvalidArgumentException(sprintf('The file "%s" does not exist.', $resource));
39 }
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function __toString()
46 {
47 return $this->resource;
48 }
49
50 /**
51 * @return string The canonicalized, absolute path to the resource
52 */
53 public function getResource()
54 {
55 return $this->resource;
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function isFresh($timestamp)
62 {
63 return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
64 }
65
66 /**
67 * @internal
68 */
69 public function serialize()
70 {
71 return serialize($this->resource);
72 }
73
74 /**
75 * @internal
76 */
77 public function unserialize($serialized)
78 {
79 $this->resource = unserialize($serialized);
80 }
81 }
82