Skip to content

Commit ce3ee26

Browse files
committed
WIP
1 parent 7000406 commit ce3ee26

23 files changed

+706
-124
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"ext-json": "*",
3939
"ext-mbstring": "*",
4040
"doctrine/deprecations": "^1.1",
41-
"phpdocumentor/filesystem": "dev-main@dev",
42-
"phpdocumentor/flyfinder": "^2.0",
41+
"phpdocumentor/filesystem": "^2.0@dev",
42+
"phpdocumentor/flyfinder": "^1.1 || ^2.0",
4343
"phpdocumentor/guides": "^2.0@dev || ^1.0",
4444
"phpdocumentor/guides-cli": "^2.0@dev || ^1.0",
4545
"phpdocumentor/guides-code": "^2.0@dev || ^1.0",
@@ -59,7 +59,7 @@
5959
"gajus/dindent": "^2.0.1",
6060
"jangregor/phpstan-prophecy": "^1.0",
6161
"league/csv": "^9.0",
62-
"league/flysystem-memory": "^1.0||^3.29",
62+
"league/flysystem-memory": "^1.0 || ^3.29",
6363
"phpbench/phpbench": "^1.3",
6464
"phpstan/extension-installer": "^1.4",
6565
"phpstan/phpstan": "^1.12",

composer.lock

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/filesystem/Flysystem/Exception.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/filesystem/Flysystem/FilesystemInterface.php

Lines changed: 286 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,296 @@
22

33
declare(strict_types=1);
44

5+
/**
6+
* This file is part of phpDocumentor.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*
11+
* @link https://phpdoc.org
12+
*/
13+
514
namespace League\Flysystem;
615

7-
use phpDocumentor\FileSystem\FileSystem;
16+
use function interface_exists;
817

9-
if (interface_exists(\League\Flysystem\FilesystemWriter::class)) {
10-
interface FilesystemInterface extends FileSystem
18+
if (interface_exists('League\Flysystem\FilesystemInterface') === false) {
19+
interface FilesystemInterface
1120
{
21+
/**
22+
* Check whether a file exists.
23+
*
24+
* @param string $path
25+
*
26+
* @return bool
27+
*/
28+
public function has($path);
29+
30+
/**
31+
* Read a file.
32+
*
33+
* @param string $path The path to the file.
34+
*
35+
* @throws FileNotFoundException
36+
*
37+
* @return string|false The file contents or false on failure.
38+
*/
39+
public function read($path);
40+
41+
/**
42+
* Retrieves a read-stream for a path.
43+
*
44+
* @param string $path The path to the file.
45+
*
46+
* @throws FileNotFoundException
47+
*
48+
* @return resource|false The path resource or false on failure.
49+
*/
50+
public function readStream($path);
51+
52+
/**
53+
* List contents of a directory.
54+
*
55+
* @param string $directory The directory to list.
56+
* @param bool $recursive Whether to list recursively.
57+
*
58+
* @return array A list of file metadata.
59+
*/
60+
public function listContents($directory = '', $recursive = false);
61+
62+
/**
63+
* Get a file's metadata.
64+
*
65+
* @param string $path The path to the file.
66+
*
67+
* @throws FileNotFoundException
68+
*
69+
* @return array|false The file metadata or false on failure.
70+
*/
71+
public function getMetadata($path);
72+
73+
/**
74+
* Get a file's size.
75+
*
76+
* @param string $path The path to the file.
77+
*
78+
* @throws FileNotFoundException
79+
*
80+
* @return int|false The file size or false on failure.
81+
*/
82+
public function getSize($path);
83+
84+
/**
85+
* Get a file's mime-type.
86+
*
87+
* @param string $path The path to the file.
88+
*
89+
* @throws FileNotFoundException
90+
*
91+
* @return string|false The file mime-type or false on failure.
92+
*/
93+
public function getMimetype($path);
94+
95+
/**
96+
* Get a file's timestamp.
97+
*
98+
* @param string $path The path to the file.
99+
*
100+
* @throws FileNotFoundException
101+
*
102+
* @return int|false The timestamp or false on failure.
103+
*/
104+
public function getTimestamp($path);
105+
106+
/**
107+
* Get a file's visibility.
108+
*
109+
* @param string $path The path to the file.
110+
*
111+
* @throws FileNotFoundException
112+
*
113+
* @return string|false The visibility (public|private) or false on failure.
114+
*/
115+
public function getVisibility($path);
116+
117+
/**
118+
* Write a new file.
119+
*
120+
* @param string $path The path of the new file.
121+
* @param string $contents The file contents.
122+
* @param array $config An optional configuration array.
123+
*
124+
* @throws FileExistsException
125+
*
126+
* @return bool True on success, false on failure.
127+
*/
128+
public function write($path, $contents, array $config = []);
129+
130+
/**
131+
* Write a new file using a stream.
132+
*
133+
* @param string $path The path of the new file.
134+
* @param resource $resource The file handle.
135+
* @param array $config An optional configuration array.
136+
*
137+
* @throws InvalidArgumentException If $resource is not a file handle.
138+
* @throws FileExistsException
139+
*
140+
* @return bool True on success, false on failure.
141+
*/
142+
public function writeStream($path, $resource, array $config = []);
143+
144+
/**
145+
* Update an existing file.
146+
*
147+
* @param string $path The path of the existing file.
148+
* @param string $contents The file contents.
149+
* @param array $config An optional configuration array.
150+
*
151+
* @throws FileNotFoundException
152+
*
153+
* @return bool True on success, false on failure.
154+
*/
155+
public function update($path, $contents, array $config = []);
156+
157+
/**
158+
* Update an existing file using a stream.
159+
*
160+
* @param string $path The path of the existing file.
161+
* @param resource $resource The file handle.
162+
* @param array $config An optional configuration array.
163+
*
164+
* @throws InvalidArgumentException If $resource is not a file handle.
165+
* @throws FileNotFoundException
166+
*
167+
* @return bool True on success, false on failure.
168+
*/
169+
public function updateStream($path, $resource, array $config = []);
170+
171+
/**
172+
* Rename a file.
173+
*
174+
* @param string $path Path to the existing file.
175+
* @param string $newpath The new path of the file.
176+
*
177+
* @throws FileExistsException Thrown if $newpath exists.
178+
* @throws FileNotFoundException Thrown if $path does not exist.
179+
*
180+
* @return bool True on success, false on failure.
181+
*/
182+
public function rename($path, $newpath);
183+
184+
/**
185+
* Copy a file.
186+
*
187+
* @param string $path Path to the existing file.
188+
* @param string $newpath The new path of the file.
189+
*
190+
* @throws FileExistsException Thrown if $newpath exists.
191+
* @throws FileNotFoundException Thrown if $path does not exist.
192+
*
193+
* @return bool True on success, false on failure.
194+
*/
195+
public function copy($path, $newpath);
196+
197+
/**
198+
* Delete a file.
199+
*
200+
* @param string $path
201+
*
202+
* @throws FileNotFoundException
203+
*
204+
* @return bool True on success, false on failure.
205+
*/
206+
public function delete($path);
207+
208+
/**
209+
* Delete a directory.
210+
*
211+
* @param string $dirname
212+
*
213+
* @throws RootViolationException Thrown if $dirname is empty.
214+
*
215+
* @return bool True on success, false on failure.
216+
*/
217+
public function deleteDir($dirname);
218+
219+
/**
220+
* Create a directory.
221+
*
222+
* @param string $dirname The name of the new directory.
223+
* @param array $config An optional configuration array.
224+
*
225+
* @return bool True on success, false on failure.
226+
*/
227+
public function createDir($dirname, array $config = []);
228+
229+
/**
230+
* Set the visibility for a file.
231+
*
232+
* @param string $path The path to the file.
233+
* @param string $visibility One of 'public' or 'private'.
234+
*
235+
* @throws FileNotFoundException
236+
*
237+
* @return bool True on success, false on failure.
238+
*/
239+
public function setVisibility($path, $visibility);
240+
241+
/**
242+
* Create a file or update if exists.
243+
*
244+
* @param string $path The path to the file.
245+
* @param string $contents The file contents.
246+
* @param array $config An optional configuration array.
247+
*
248+
* @return bool True on success, false on failure.
249+
*/
250+
public function put($path, $contents, array $config = []);
251+
252+
/**
253+
* Create a file or update if exists.
254+
*
255+
* @param string $path The path to the file.
256+
* @param resource $resource The file handle.
257+
* @param array $config An optional configuration array.
258+
*
259+
* @throws InvalidArgumentException Thrown if $resource is not a resource.
260+
*
261+
* @return bool True on success, false on failure.
262+
*/
263+
public function putStream($path, $resource, array $config = []);
264+
265+
/**
266+
* Read and delete a file.
267+
*
268+
* @param string $path The path to the file.
269+
*
270+
* @throws FileNotFoundException
271+
*
272+
* @return string|false The file contents, or false on failure.
273+
*/
274+
public function readAndDelete($path);
275+
276+
/**
277+
* Get a file/directory handler.
278+
*
279+
* @deprecated
280+
*
281+
* @param string $path The path to the file.
282+
* @param Handler $handler An optional existing handler to populate.
283+
*
284+
* @return Handler Either a file or directory handler.
285+
*/
286+
public function get($path, Handler $handler = null);
12287

288+
/**
289+
* Register a plugin.
290+
*
291+
* @param PluginInterface $plugin The plugin to register.
292+
*
293+
* @return $this
294+
*/
295+
public function addPlugin(PluginInterface $plugin);
13296
}
14297
}

0 commit comments

Comments
 (0)