1<?php
2
3declare(strict_types=1);
4
5namespace League\Flysystem;
6
7interface FilesystemAdapter
8{
9    /**
10     * @throws FilesystemException
11     */
12    public function fileExists(string $path): bool;
13
14    /**
15     * @throws UnableToWriteFile
16     * @throws FilesystemException
17     */
18    public function write(string $path, string $contents, Config $config): void;
19
20    /**
21     * @param resource $contents
22     *
23     * @throws UnableToWriteFile
24     * @throws FilesystemException
25     */
26    public function writeStream(string $path, $contents, Config $config): void;
27
28    /**
29     * @throws UnableToReadFile
30     * @throws FilesystemException
31     */
32    public function read(string $path): string;
33
34    /**
35     * @return resource
36     *
37     * @throws UnableToReadFile
38     * @throws FilesystemException
39     */
40    public function readStream(string $path);
41
42    /**
43     * @throws UnableToDeleteFile
44     * @throws FilesystemException
45     */
46    public function delete(string $path): void;
47
48    /**
49     * @throws UnableToDeleteDirectory
50     * @throws FilesystemException
51     */
52    public function deleteDirectory(string $path): void;
53
54    /**
55     * @throws UnableToCreateDirectory
56     * @throws FilesystemException
57     */
58    public function createDirectory(string $path, Config $config): void;
59
60    /**
61     * @throws InvalidVisibilityProvided
62     * @throws FilesystemException
63     */
64    public function setVisibility(string $path, string $visibility): void;
65
66    /**
67     * @throws UnableToRetrieveMetadata
68     * @throws FilesystemException
69     */
70    public function visibility(string $path): FileAttributes;
71
72    /**
73     * @throws UnableToRetrieveMetadata
74     * @throws FilesystemException
75     */
76    public function mimeType(string $path): FileAttributes;
77
78    /**
79     * @throws UnableToRetrieveMetadata
80     * @throws FilesystemException
81     */
82    public function lastModified(string $path): FileAttributes;
83
84    /**
85     * @throws UnableToRetrieveMetadata
86     * @throws FilesystemException
87     */
88    public function fileSize(string $path): FileAttributes;
89
90    /**
91     * @return iterable<StorageAttributes>
92     *
93     * @throws FilesystemException
94     */
95    public function listContents(string $path, bool $deep): iterable;
96
97    /**
98     * @throws UnableToMoveFile
99     * @throws FilesystemException
100     */
101    public function move(string $source, string $destination, Config $config): void;
102
103    /**
104     * @throws UnableToCopyFile
105     * @throws FilesystemException
106     */
107    public function copy(string $source, string $destination, Config $config): void;
108}
109