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) |
||
54 | |||
55 | public function read(string $filename): string |
||
59 | |||
60 | public function put(string $filename, string $contents) |
||
68 | |||
69 | public function delete(string $fileName) |
||
73 | |||
74 | public function copy(string $filePath, string $fileName) |
||
82 | |||
83 | public function fileEquals(string $filePath, string $fileName) |
||
87 | } |
||
88 |