FilesystemReader.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. declare(strict_types=1);
  3. namespace League\Flysystem;
  4. /**
  5. * This interface contains everything to read from and inspect
  6. * a filesystem. All methods containing are non-destructive.
  7. */
  8. interface FilesystemReader
  9. {
  10. public const LIST_SHALLOW = false;
  11. public const LIST_DEEP = true;
  12. /**
  13. * @throws FilesystemException
  14. * @throws UnableToCheckFileExistence
  15. */
  16. public function fileExists(string $location): bool;
  17. /**
  18. * @throws UnableToReadFile
  19. * @throws FilesystemException
  20. */
  21. public function read(string $location): string;
  22. /**
  23. * @return resource
  24. *
  25. * @throws UnableToReadFile
  26. * @throws FilesystemException
  27. */
  28. public function readStream(string $location);
  29. /**
  30. * @return DirectoryListing<StorageAttributes>
  31. *
  32. * @throws FilesystemException
  33. */
  34. public function listContents(string $location, bool $deep = self::LIST_SHALLOW): DirectoryListing;
  35. /**
  36. * @throws UnableToRetrieveMetadata
  37. * @throws FilesystemException
  38. */
  39. public function lastModified(string $path): int;
  40. /**
  41. * @throws UnableToRetrieveMetadata
  42. * @throws FilesystemException
  43. */
  44. public function fileSize(string $path): int;
  45. /**
  46. * @throws UnableToRetrieveMetadata
  47. * @throws FilesystemException
  48. */
  49. public function mimeType(string $path): string;
  50. /**
  51. * @throws UnableToRetrieveMetadata
  52. * @throws FilesystemException
  53. */
  54. public function visibility(string $path): string;
  55. }