-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesystemInterface.php
More file actions
76 lines (55 loc) · 2.06 KB
/
FilesystemInterface.php
File metadata and controls
76 lines (55 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
declare(strict_types=1);
namespace SonsOfPHP\Contract\Filesystem;
use SonsOfPHP\Contract\Filesystem\Exception\FilesystemExceptionInterface;
/**
* @author Joshua Estes <joshua@sonsofphp.com>
*/
interface FilesystemInterface
{
/**
* @param string|resource $content
*
* @throws FilesystemExceptionInterface
*/
public function write(string $path, mixed $content, ContextInterface|array $context = null): void;
// or put, putContents
// could write not do this by default? Maybe option to overwrite if exists?
//public function append(string $filename, mixed $content): void;
/**
* @throws FilesystemExceptionInterface
*/
public function read(string $path, ContextInterface|array $context = null): string;
// or get, getContents
/**
* @throws FilesystemExceptionInterface
*/
public function delete(string $path, ContextInterface|array $context = null): void;
// or remove, rm, rmdir
/**
* Checks to see if a file or directory exists
*
* @throws FilesystemExceptionInterface Generic Failure Exception
*/
public function exists(string $path, ContextInterface|array $context = null): bool;
//public function isFile(string $path, ?ContextInterface $context = null): bool;
/**
* @throws FilesystemExceptionInterface
*/
public function copy(string $source, string $destination, ContextInterface|array $context = null): void;
// or cp
/**
* @throws FilesystemExceptionInterface
*/
public function move(string $source, string $destination, ContextInterface|array $context = null): void;
// or mv
//public function createDirectory(string|iterable $dirs): bool;
// or mkdir
//public function isDir(string $filename): bool;
//public function isReadable(string $filename): bool;
//public function isWritable(string $filename): bool;
/**
* @throws FilesystemExceptionInterface Generic Failure Exception
*/
public function mimeType(string $path, ContextInterface|array $context = null): string;
}