@@ -43,33 +43,33 @@ private function checkPermissions(string $path, int $permissions): bool {
43
43
return ($ this ->getACLPermissionsForPath ($ path ) & $ permissions ) === $ permissions ;
44
44
}
45
45
46
- public function isReadable ($ path ): bool {
46
+ public function isReadable (string $ path ): bool {
47
47
return $ this ->checkPermissions ($ path , Constants::PERMISSION_READ ) && parent ::isReadable ($ path );
48
48
}
49
49
50
- public function isUpdatable ($ path ): bool {
50
+ public function isUpdatable (string $ path ): bool {
51
51
return $ this ->checkPermissions ($ path , Constants::PERMISSION_UPDATE ) && parent ::isUpdatable ($ path );
52
52
}
53
53
54
- public function isCreatable ($ path ): bool {
54
+ public function isCreatable (string $ path ): bool {
55
55
return $ this ->checkPermissions ($ path , Constants::PERMISSION_CREATE ) && parent ::isCreatable ($ path );
56
56
}
57
57
58
- public function isDeletable ($ path ): bool {
58
+ public function isDeletable (string $ path ): bool {
59
59
return $ this ->checkPermissions ($ path , Constants::PERMISSION_DELETE )
60
60
&& $ this ->canDeleteTree ($ path )
61
61
&& parent ::isDeletable ($ path );
62
62
}
63
63
64
- public function isSharable ($ path ): bool {
64
+ public function isSharable (string $ path ): bool {
65
65
return $ this ->checkPermissions ($ path , Constants::PERMISSION_SHARE ) && parent ::isSharable ($ path );
66
66
}
67
67
68
- public function getPermissions ($ path ): int {
68
+ public function getPermissions (string $ path ): int {
69
69
return $ this ->storage ->getPermissions ($ path ) & $ this ->getACLPermissionsForPath ($ path );
70
70
}
71
71
72
- public function rename ($ source , $ target ): bool {
72
+ public function rename (string $ source , string $ target ): bool {
73
73
if (str_starts_with ($ source , $ target )) {
74
74
$ part = substr ($ source , strlen ($ target ));
75
75
//This is a rename of the transfer file to the original file
@@ -96,7 +96,7 @@ public function rename($source, $target): bool {
96
96
parent ::rename ($ source , $ target );
97
97
}
98
98
99
- public function opendir ($ path ) {
99
+ public function opendir (string $ path ) {
100
100
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
101
101
return false ;
102
102
}
@@ -118,29 +118,29 @@ public function opendir($path) {
118
118
return IteratorDirectory::wrap ($ items );
119
119
}
120
120
121
- public function copy ($ source , $ target ): bool {
121
+ public function copy (string $ source , string $ target ): bool {
122
122
$ permissions = $ this ->file_exists ($ target ) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE ;
123
123
return $ this ->checkPermissions ($ target , $ permissions ) &&
124
124
$ this ->checkPermissions ($ source , Constants::PERMISSION_READ ) &&
125
125
parent ::copy ($ source , $ target );
126
126
}
127
127
128
- public function touch ($ path , $ mtime = null ): bool {
128
+ public function touch (string $ path , ? int $ mtime = null ): bool {
129
129
$ permissions = $ this ->file_exists ($ path ) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE ;
130
130
return $ this ->checkPermissions ($ path , $ permissions ) && parent ::touch ($ path , $ mtime );
131
131
}
132
132
133
- public function mkdir ($ path ): bool {
133
+ public function mkdir (string $ path ): bool {
134
134
return $ this ->checkPermissions ($ path , Constants::PERMISSION_CREATE ) && parent ::mkdir ($ path );
135
135
}
136
136
137
- public function rmdir ($ path ): bool {
137
+ public function rmdir (string $ path ): bool {
138
138
return $ this ->checkPermissions ($ path , Constants::PERMISSION_DELETE )
139
139
&& $ this ->canDeleteTree ($ path )
140
140
&& parent ::rmdir ($ path );
141
141
}
142
142
143
- public function unlink ($ path ): bool {
143
+ public function unlink (string $ path ): bool {
144
144
return $ this ->checkPermissions ($ path , Constants::PERMISSION_DELETE )
145
145
&& $ this ->canDeleteTree ($ path )
146
146
&& parent ::unlink ($ path );
@@ -154,12 +154,12 @@ private function canDeleteTree(string $path): int {
154
154
return $ this ->aclManager ->getPermissionsForTree ($ path ) & Constants::PERMISSION_DELETE ;
155
155
}
156
156
157
- public function file_put_contents ($ path , $ data ): int |float |false {
157
+ public function file_put_contents (string $ path , mixed $ data ): int |float |false {
158
158
$ permissions = $ this ->file_exists ($ path ) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE ;
159
159
return $ this ->checkPermissions ($ path , $ permissions ) ? parent ::file_put_contents ($ path , $ data ) : false ;
160
160
}
161
161
162
- public function fopen ($ path , $ mode ) {
162
+ public function fopen (string $ path , string $ mode ) {
163
163
if ($ mode === 'r ' or $ mode === 'rb ' ) {
164
164
$ permissions = Constants::PERMISSION_READ ;
165
165
} else {
@@ -189,7 +189,7 @@ public function getCache($path = '', $storage = null): ICache {
189
189
return new ACLCacheWrapper ($ sourceCache , $ this ->aclManager , $ this ->inShare );
190
190
}
191
191
192
- public function getMetaData ($ path ): ?array {
192
+ public function getMetaData (string $ path ): ?array {
193
193
$ data = parent ::getMetaData ($ path );
194
194
195
195
if ($ data && isset ($ data ['permissions ' ])) {
@@ -213,94 +213,94 @@ public function getScanner($path = '', $storage = null): IScanner {
213
213
return parent ::getScanner ($ path , $ storage );
214
214
}
215
215
216
- public function is_dir ($ path ): bool {
216
+ public function is_dir (string $ path ): bool {
217
217
return $ this ->checkPermissions ($ path , Constants::PERMISSION_READ ) &&
218
218
parent ::is_dir ($ path );
219
219
}
220
220
221
- public function is_file ($ path ): bool {
221
+ public function is_file (string $ path ): bool {
222
222
return $ this ->checkPermissions ($ path , Constants::PERMISSION_READ ) &&
223
223
parent ::is_file ($ path );
224
224
}
225
225
226
- public function stat ($ path ): array |false {
226
+ public function stat (string $ path ): array |false {
227
227
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
228
228
return false ;
229
229
}
230
230
231
231
return parent ::stat ($ path );
232
232
}
233
233
234
- public function filetype ($ path ): string |false {
234
+ public function filetype (string $ path ): string |false {
235
235
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
236
236
return false ;
237
237
}
238
238
239
239
return parent ::filetype ($ path );
240
240
}
241
241
242
- public function filesize ($ path ): false |int |float {
242
+ public function filesize (string $ path ): false |int |float {
243
243
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
244
244
return false ;
245
245
}
246
246
247
247
return parent ::filesize ($ path );
248
248
}
249
249
250
- public function file_exists ($ path ): bool {
250
+ public function file_exists (string $ path ): bool {
251
251
return $ this ->checkPermissions ($ path , Constants::PERMISSION_READ ) &&
252
252
parent ::file_exists ($ path );
253
253
}
254
254
255
- public function filemtime ($ path ): int |false {
255
+ public function filemtime (string $ path ): int |false {
256
256
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
257
257
return false ;
258
258
}
259
259
260
260
return parent ::filemtime ($ path );
261
261
}
262
262
263
- public function file_get_contents ($ path ): string |false {
263
+ public function file_get_contents (string $ path ): string |false {
264
264
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
265
265
return false ;
266
266
}
267
267
268
268
return parent ::file_get_contents ($ path );
269
269
}
270
270
271
- public function getMimeType ($ path ): string |false {
271
+ public function getMimeType (string $ path ): string |false {
272
272
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
273
273
return false ;
274
274
}
275
275
276
276
return parent ::getMimeType ($ path );
277
277
}
278
278
279
- public function hash ($ type , $ path , $ raw = false ): string |false {
279
+ public function hash (string $ type , string $ path , bool $ raw = false ): string |false {
280
280
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
281
281
return false ;
282
282
}
283
283
284
284
return parent ::hash ($ type , $ path , $ raw );
285
285
}
286
286
287
- public function getETag ($ path ): string |false {
287
+ public function getETag (string $ path ): string |false {
288
288
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
289
289
return false ;
290
290
}
291
291
292
292
return parent ::getETag ($ path );
293
293
}
294
294
295
- public function getDirectDownload ($ path ): array |false {
295
+ public function getDirectDownload (string $ path ): array |false {
296
296
if (!$ this ->checkPermissions ($ path , Constants::PERMISSION_READ )) {
297
297
return false ;
298
298
}
299
299
300
300
return parent ::getDirectDownload ($ path );
301
301
}
302
302
303
- public function getDirectoryContent ($ directory ): \Traversable {
303
+ public function getDirectoryContent (string $ directory ): \Traversable {
304
304
$ content = $ this ->getWrapperStorage ()->getDirectoryContent ($ directory );
305
305
foreach ($ content as $ data ) {
306
306
$ data ['scan_permissions ' ] ??= $ data ['permissions ' ];
0 commit comments