Repository navigation
Expand file tree
/
Copy pathStorageInterface.php
More file actions
203 lines (178 loc) · 4.95 KB
/
Copy pathStorageInterface.php
File metadata and controls
203 lines (178 loc) · 4.95 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
/**
* @author: Jens Giessmann <jg@handcode.de>
*
* @copyright: 2025, Jens Giessmann
*/
namespace handcode\flysystem\interfaces;
use League\Flysystem\DirectoryListing;
use League\Flysystem\FilesystemOperator;
use League\Flysystem\FilesystemReader;
/**
* StorageInterface extends the League\Flysystem\FilesystemOperator interface and
* adds some shortcut/wrapper methods
*/
interface StorageInterface extends FilesystemOperator
{
# ---- methods that are not part of the Flysystem\FilesystemOperator -----
/**
* shortcut/wrapper for listContents
* get a list of files and directories in given $location
* if $recursive == true, also subdirectories are listed
*
* @param string $location
* @param bool $recursive
*
* @return DirectoryListing
*/
public function list(string $location, bool $recursive = FilesystemReader::LIST_SHALLOW): DirectoryListing;
/**
* get a list of files in given $location
* if $recursive == true, also files from subdirectories are listed
*
* @param string $location
* @param bool $recursive
*
* @return DirectoryListing
*/
public function files(string $location, bool $recursive = FilesystemReader::LIST_SHALLOW): DirectoryListing;
/**
* get a list of directories in given $location
* if $recursive == true, also subdirectories are listed
*
* @param string $location
* @param bool $recursive
*
* @return DirectoryListing
*/
public function directories(string $location, bool $recursive = FilesystemReader::LIST_SHALLOW): DirectoryListing;
# ---- methods from FilesystemReader -----
/**
* check if file exists
*
* @param string $location
*
* @return bool
*/
public function fileExists(string $location): bool;
/**
* check if dir exists
*
* @param string $location
*
* @return bool
*/
public function directoryExists(string $location): bool;
/**
* check if a file or directory exists
*
* @param string $location
*
* @return bool
*/
public function has(string $location): bool;
/**
* get the file contents as string
*
* @param string $location
*
* @return string
*/
public function read(string $location): string;
/**
* get file contents resource handle
*
* @param string $location
*
* @return resource
*/
public function readStream(string $location);
/**
* get a League\Flysystem\DirectoryListing Generator to get contents of a directory.
* - This is a low level method.
* - To get lists as arrays for files, directories, or all types, better use self::list(),
* self::files() or self::directories()
*
* @param string $location
* @param bool $deep
*
* @return DirectoryListing
*/
public function listContents(string $location, bool $deep = FilesystemReader::LIST_SHALLOW): DirectoryListing;
/**
* get the lastModified timestamp of a file
*
* @param string $path
*
* @return int
*/
public function lastModified(string $path): int;
/**
* get the size of a file
*
* @param string $path
*
* @return int
*/
public function fileSize(string $path): int;
/**
* get the mimeType of a file
*
* @param string $path
*
* @return string
*/
public function mimeType(string $path): string;
# ---- methods from FilesystemWriter ----
/**
* write the content as string to a file
*
* @param string $location
* @param string $contents
* @param array $config
*/
public function write(string $location, string $contents, array $config = []): void;
/**
* write the content as stream to a file
*
* @param string $location
* @param resource $contents
* @param array $config
*/
public function writeStream(string $location, $contents, array $config = []): void;
/**
* delete a file
*
* @param string $location
*/
public function delete(string $location): void;
/**
* delete a directory
*
* @param string $location
*/
public function deleteDirectory(string $location): void;
/**
* creat a directory
*
* @param string $location
* @param array $config
*/
public function createDirectory(string $location, array $config = []): void;
/**
* move a file to a new destination
*
* @param string $source
* @param string $destination
* @param array $config
*/
public function move(string $source, string $destination, array $config = []): void;
/**
* copy content of a file to a new destination
*
* @param string $source
* @param string $destination
* @param array $config
*/
public function copy(string $source, string $destination, array $config = []): void;
}