| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace League\Flysystem;
|
|
|
6 |
|
|
|
7 |
use DateTimeInterface;
|
|
|
8 |
|
|
|
9 |
/**
|
|
|
10 |
* This interface contains everything to read from and inspect
|
|
|
11 |
* a filesystem. All methods containing are non-destructive.
|
|
|
12 |
*
|
|
|
13 |
* @method string publicUrl(string $path, array $config = []) Will be added in 4.0
|
|
|
14 |
* @method string temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []) Will be added in 4.0
|
|
|
15 |
* @method string checksum(string $path, array $config = []) Will be added in 4.0
|
|
|
16 |
*/
|
|
|
17 |
interface FilesystemReader
|
|
|
18 |
{
|
|
|
19 |
public const LIST_SHALLOW = false;
|
|
|
20 |
public const LIST_DEEP = true;
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* @throws FilesystemException
|
|
|
24 |
* @throws UnableToCheckExistence
|
|
|
25 |
*/
|
|
|
26 |
public function fileExists(string $location): bool;
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* @throws FilesystemException
|
|
|
30 |
* @throws UnableToCheckExistence
|
|
|
31 |
*/
|
|
|
32 |
public function directoryExists(string $location): bool;
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* @throws FilesystemException
|
|
|
36 |
* @throws UnableToCheckExistence
|
|
|
37 |
*/
|
|
|
38 |
public function has(string $location): bool;
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* @throws UnableToReadFile
|
|
|
42 |
* @throws FilesystemException
|
|
|
43 |
*/
|
|
|
44 |
public function read(string $location): string;
|
|
|
45 |
|
|
|
46 |
/**
|
|
|
47 |
* @return resource
|
|
|
48 |
*
|
|
|
49 |
* @throws UnableToReadFile
|
|
|
50 |
* @throws FilesystemException
|
|
|
51 |
*/
|
|
|
52 |
public function readStream(string $location);
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
* @return DirectoryListing<StorageAttributes>
|
|
|
56 |
*
|
|
|
57 |
* @throws FilesystemException
|
|
|
58 |
* @throws UnableToListContents
|
|
|
59 |
*/
|
|
|
60 |
public function listContents(string $location, bool $deep = self::LIST_SHALLOW): DirectoryListing;
|
|
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
* @throws UnableToRetrieveMetadata
|
|
|
64 |
* @throws FilesystemException
|
|
|
65 |
*/
|
|
|
66 |
public function lastModified(string $path): int;
|
|
|
67 |
|
|
|
68 |
/**
|
|
|
69 |
* @throws UnableToRetrieveMetadata
|
|
|
70 |
* @throws FilesystemException
|
|
|
71 |
*/
|
|
|
72 |
public function fileSize(string $path): int;
|
|
|
73 |
|
|
|
74 |
/**
|
|
|
75 |
* @throws UnableToRetrieveMetadata
|
|
|
76 |
* @throws FilesystemException
|
|
|
77 |
*/
|
|
|
78 |
public function mimeType(string $path): string;
|
|
|
79 |
|
|
|
80 |
/**
|
|
|
81 |
* @throws UnableToRetrieveMetadata
|
|
|
82 |
* @throws FilesystemException
|
|
|
83 |
*/
|
|
|
84 |
public function visibility(string $path): string;
|
|
|
85 |
}
|