FilesystemAdapter.php 2.5 KB

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