-
-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathStorage.php
More file actions
118 lines (94 loc) · 3.38 KB
/
Storage.php
File metadata and controls
118 lines (94 loc) · 3.38 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
namespace Tempest\Storage;
use DateTimeInterface;
interface Storage
{
/**
* Writes the given `$contents` to the specified `$location`.
*/
public function write(string $location, string $contents): static;
/**
* Writes the given `$contents` to the specified `$location`.
*/
public function writeStream(string $location, mixed $contents): static;
/**
* Writes the contents of the file at the specified `$location`.
*/
public function read(string $location): string;
/**
* Returns the contents of the file at the specified `$location` as a stream.
*/
public function readStream(string $location): mixed;
/**
* Determines whether a file exists at the specified `$location`.
*/
public function fileExists(string $location): bool;
/**
* Determines whether a directory exists at the specified `$location`.
*/
public function directoryExists(string $location): bool;
/**
* Determines whether a file or a directory exists at the specified `$location`.
*/
public function fileOrDirectoryExists(string $location): bool;
/**
* Deletes the file or directory at the specified `$location`.
*/
public function delete(string $location): static;
/**
* Deletes the directory at the specified `$location`.
*/
public function deleteDirectory(?string $location = ''): static;
/**
* Creates a directory at the specified `$location`.
*/
public function createDirectory(?string $location = ''): static;
/**
* Cleans the directory at the specified `$location`.
*/
public function cleanDirectory(?string $location = ''): static;
/**
* Moves the file or directory from `$source` to `$destination`.
*/
public function move(string $source, string $destination): static;
/**
* Copies the file or directory from `$source` to `$destination`.
*/
public function copy(string $source, string $destination): static;
/**
* Returns the size of the file at the specified `$location`.
*/
public function fileSize(string $location): int;
/**
* Returns the last modified time of the file at the specified `$location`.
*/
public function lastModified(string $location): int;
/**
* Returns the mime type of the file at the specified `$location`.
*/
public function mimeType(string $location): string;
/**
* Sets the visibility of the file at the specified `$location`.
*/
public function setVisibility(string $location, string $visibility): static;
/**
* Returns the visibility of the file at the specified `$location`.
*/
public function visibility(string $location): string;
/**
* Gets a public URL to the file at the specified `$location`.
*/
public function publicUrl(string $location): string;
/**
* Gets a temporary URL to the file at the specified `$location` that expires at the specified `$expiresAt` time.
*/
public function temporaryUrl(string $location, DateTimeInterface $expiresAt): string;
/**
* Gets a checksum of the file at the specified `$location`.
*/
public function checksum(string $location): string;
/**
* Lists files in the directory at the specified `$location`.
*/
public function list(string $location = '', bool $deep = false): DirectoryListing;
}