Repository navigation
Expand file tree
/
Copy pathStorageComponentInterface.php
More file actions
158 lines (140 loc) · 4.73 KB
/
Copy pathStorageComponentInterface.php
File metadata and controls
158 lines (140 loc) · 4.73 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
<?php
/**
* @author: Jens Giessmann <jg@handcode.de>
*
* @copyright: 2025, Jens Giessmann
*/
namespace handcode\flysystem\interfaces;
use League\Flysystem\FilesystemAdapter;
/**
* StorageComponentInterface extends StorageInterface and adds getter/setter for
* the component properties like the
* - FilesystemAdapter
* - if storage should be readOnly
* - etc.
*/
interface StorageComponentInterface extends StorageInterface
{
/**
* set the FilesystemAdapter for this Filesystem
* - can be a callable or a League\Flysystem\FilesystemAdapter instance
* - if callable, the return value must be a League\Flysystem\FilesystemAdapter instance
*
* @param callable|FilesystemAdapter $adapter
*/
public function setAdapter(callable|FilesystemAdapter $adapter): void;
/**
* set the class that should be used as FilesystemOperator
* - given class must implement League\Flysystem\FilesystemOperator interface
* - default is (or should be) League\Flysystem\Filesystem
*
* @param string $className
*/
public function setFilesystemOperatorClass(string $className): void;
/**
* set the path prefix for scoped fileSystems
* if set the prefix will be appended to all given location strings
*
* @param callable|string $scopePrefix
*/
public function setScope(callable|string $scopePrefix): void;
/**
* if true, ensure root Dir (or defined scope) exists
*
* @param bool $flag
*/
public function setEnsureRoot(bool $flag = true): void;
/**
* if true fs will be mounted readOnly
*
* @param bool|callable $flag
*/
public function setReadOnly(bool|callable $flag = false): void;
/**
* whether the Storage is mounted readOnly
*
* @return bool
*/
public function isReadOnly(): bool;
/**
* if true, parent dirs will be created on demand (flysystem default behaviour)
* handle with care!
*
* @see https://flysystem.thephpleague.com/docs/architecture/#directories-are-only-created-when-needed
*
* @param bool $flag
*/
public function setCreateDirOnDemand(bool $flag = false): void;
/**
* whether the Storage should create parent dirs on demand
* if false, all parents MUST exist (which should be the default IMHO...)
*
* @return bool
*/
public function getCreateDirOnDemand(): bool;
/**
* set additional decorator adapter which are not handled by the default settings like "readOnly"
* each array item must be:
* - class Name of the Decorator
* - optional $options array which will be used while initialising the decorator
*
* @param null|array $decorators
*/
public function setDecoratorAdapter(?array $decorators): void;
/**
* if true, not empty dirs will be deleted recursively
* handle with care!
*
* @see https://flysystem.thephpleague.com/docs/architecture/#directories-are-only-created-when-needed
*
* @param bool $flag
*/
public function setDeleteDirRecursive(bool $flag = false): void;
/**
* whether the Storage should delete not empty dirs recursively
* if false, dirs can only be deleted if they are empty
* (which should be the default IMHO...)
*
* @return bool
*/
public function getDeleteDirRecursive(): bool;
/**
* optional callback that is used to map StorageAttributes in list* methods
* prototype for the function is:
* `function (StorageAttributes $attributes): StorageAttributes`
*
* @var null|callable $listMapper
*/
public function setListMapper(?callable $listMapper): void;
/**
* if true, FileSystemAdapter::mimeType() will be called for each item
* in listContent map() if not set already
*
* @param bool $flag
*/
public function setPopulateMimeType(bool $flag = false): void;
/**
* if callback is set it will be called to get extraMetaData for given item
* in listContent map()
*
* prototype: callback($storageAttributes):array
*
* Param: StorageAttributes instance with 'current' values
*
* Return: As other Decorator Adapter can have set/add/modify metaData,
* it is best practice to return a merge of
* - the given StorageAttributes::extraMetaData()
* - the new array values
*
* @param null|callable $callable $callable
*/
public function setMetaDataCallback(?callable $callable): void;
/**
* set callback that is used to filter contents
* prototype: callback($storageAttributes):bool
* Param: StorageAttributes instance with 'current' values
*
* @param callable $callable
*/
public function setFilterCallback(callable $callable): void;
}