1 | <?php |
||
5 | class Filesystem |
||
6 | { |
||
7 | /** @var string */ |
||
8 | private $basePath; |
||
9 | |||
10 | public function __construct(string $basePath) |
||
14 | |||
15 | public static function inDirectory(string $path): self |
||
19 | |||
20 | public function path(string $filename): string |
||
24 | |||
25 | public function has(string $filename): bool |
||
29 | |||
30 | /** |
||
31 | * Get all file names in this directory that have the same name |
||
32 | * as $fileName, but have a different file extension. |
||
33 | * @param string $fileName |
||
34 | * @return array |
||
35 | */ |
||
36 | public function getNamesWithDifferentExtension(string $fileName) |
||
58 | |||
59 | public function read(string $filename): string |
||
63 | |||
64 | public function put(string $filename, string $contents) |
||
72 | |||
73 | public function delete(string $fileName) |
||
77 | |||
78 | public function copy(string $filePath, string $fileName) |
||
86 | |||
87 | public function fileEquals(string $filePath, string $fileName) |
||
91 | } |
||
92 |