-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFilesystemInterface.php
More file actions
201 lines (188 loc) · 5.2 KB
/
FilesystemInterface.php
File metadata and controls
201 lines (188 loc) · 5.2 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
<?php
/**
* Filesystem Adapter Interface
*
* @package Filesystem
* @copyright 2014-2015 Amy Stephen. All rights reserved.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
namespace CommonApi\Filesystem;
/**
* Filesystem Adapter Interface
*
* @package Filesystem
* @copyright 2014-2015 Amy Stephen. All rights reserved.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @since 1.0
*/
interface FilesystemInterface
{
/**
* Determines if file or folder identified in path exists
*
* @param string $path
*
* @return bool
* @since 1.0.0
*/
public function exists($path);
/**
* Returns an associative array of metadata for the file or folder specified in path
*
* @param string $path
*
* @return mixed
* @since 1.0.0
*/
public function getMetadata($path);
/**
* Returns the contents of the file identified in path
*
* @param string $path
*
* @return null|string
* @since 1.0.0
*/
public function read($path);
/**
* Returns a list of file and folder names located at path directory, optionally recursively,
* optionally filtered by a list of file extension values, filename mask, and inclusion or exclusion
* of files and/or folders
*
* @param string $path
* @param bool $recursive
* @param string $extension_list
* @param bool $include_files
* @param bool $include_folders
* @param null $filename_mask
*
* @return mixed
* @since 1.0.0
*/
public function getList(
$path,
$recursive = false,
$extension_list = '',
$include_files = false,
$include_folders = false,
$filename_mask = null
);
/**
* Creates (or replaces) the file or creates the directory identified in path;
*
* @param string $path
* @param string $data (file, only)
* @param bool $replace (file, only)
* @param bool $append (file, only)
* @param bool $truncate (file, only)
*
* @return $this
* @since 1.0.0
*/
public function write($path, $data = '', $replace = true, $append = false, $truncate = false);
/**
* Deletes the file or folder identified in path, optionally deletes recursively
*
* @param string $path
* @param bool $recursive
*
* @return $this
* @since 1.0.0
*/
public function delete($path, $recursive = false);
/**
* Copies the file/folder in $path to the target_directory (optionally target_name),
* replacing content, if indicated. Can copy to target_handler.
*
* @param string $path
* @param string $target_directory
* @param string $target_name
* @param bool $replace
* @param string $target_handler
*
* @return $this
* @since 1.0.0
*/
public function copy(
$path,
$target_directory,
$target_name = '',
$replace = true,
$target_handler = ''
);
/**
* Moves the file/folder in $path to the target_directory (optionally target_name),
* replacing content, if indicated. Can move to target_handler.
*
* @param string $path
* @param string $target_directory
* @param string $target_name
* @param bool $replace
* @param string $target_handler
*
* @return $this
* @since 1.0.0
*/
public function move(
$path,
$target_directory,
$target_name = '',
$replace = true,
$target_handler = ''
);
/**
* Rename file or folder identified in path
*
* @param string $path
* @param string $new_name
*
* @return $this
* @since 1.0.0
*/
public function rename($path, $new_name);
/**
* Change owner for file or folder identified in path
*
* @param string $path
* @param string $user_name
* @param bool $recursive
*
* @return $this
* @since 1.0.0
*/
public function changeOwner($path, $user_name, $recursive = false);
/**
* Change group for file or folder identified in path
*
* @param string $path
* @param string $group_id
* @param bool $recursive
*
* @return $this
* @since 1.0.0
*/
public function changeGroup($path, $group_id, $recursive = false);
/**
* Change permissions for file or folder identified in path
*
* @param string $path
* @param int $permission
* @param bool $recursive
*
* @return $this
* @since 1.0.0
*/
public function changePermission($path, $permission, $recursive = false);
/**
* Update the modification time and access time (touch) for the directory or file identified in the path
*
* @param string $path
* @param int $modification_time
* @param int $access_time
* @param bool $recursive
*
* @return $this
* @since 1.0.0
*/
public function touch($path, $modification_time = null, $access_time = null, $recursive = false);
}