説明なし

FilesystemInterface.php 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <?php
  2. namespace League\Flysystem;
  3. interface FilesystemInterface
  4. {
  5. /**
  6. * Check whether a file exists.
  7. *
  8. * @param string $path
  9. *
  10. * @return bool
  11. */
  12. public function has($path);
  13. /**
  14. * Read a file.
  15. *
  16. * @param string $path
  17. *
  18. * @return false|string
  19. */
  20. public function read($path);
  21. /**
  22. * Read a file as a stream.
  23. *
  24. * @param string $path
  25. *
  26. * @return false|resource
  27. */
  28. public function readStream($path);
  29. /**
  30. * List contents of a directory.
  31. *
  32. * @param string $directory
  33. * @param bool $recursive
  34. *
  35. * @return array
  36. */
  37. public function listContents($directory = '', $recursive = false);
  38. /**
  39. * Get all the meta data of a file or directory.
  40. *
  41. * @param string $path
  42. *
  43. * @return false|array
  44. */
  45. public function getMetadata($path);
  46. /**
  47. * Get all the meta data of a file or directory.
  48. *
  49. * @param string $path
  50. *
  51. * @return false|int
  52. */
  53. public function getSize($path);
  54. /**
  55. * Get the mime-type of a file.
  56. *
  57. * @param string $path
  58. *
  59. * @return false|string
  60. */
  61. public function getMimetype($path);
  62. /**
  63. * Get the timestamp of a file.
  64. *
  65. * @param string $path
  66. *
  67. * @return false|int
  68. */
  69. public function getTimestamp($path);
  70. /**
  71. * Get the visibility of a file.
  72. *
  73. * @param string $path
  74. *
  75. * @return false|string
  76. */
  77. public function getVisibility($path);
  78. /**
  79. * Write a new file.
  80. *
  81. * @param string $path
  82. * @param string $contents
  83. * @param array $config Config array
  84. *
  85. * @return bool success boolean
  86. */
  87. public function write($path, $contents, array $config = []);
  88. /**
  89. * Write a new file using a stream.
  90. *
  91. * @param string $path
  92. * @param resource $resource
  93. * @param array $config config array
  94. *
  95. * @return bool success boolean
  96. */
  97. public function writeStream($path, $resource, array $config = []);
  98. /**
  99. * Update a file.
  100. *
  101. * @param string $path
  102. * @param string $contents
  103. * @param array $config config array
  104. *
  105. * @return bool success boolean
  106. */
  107. public function update($path, $contents, array $config = []);
  108. /**
  109. * Update a file using a stream.
  110. *
  111. * @param string $path
  112. * @param resource $resource
  113. * @param array $config config array
  114. *
  115. * @return bool success boolean
  116. */
  117. public function updateStream($path, $resource, array $config = []);
  118. /**
  119. * Rename a file.
  120. *
  121. * @param string $path
  122. * @param string $newpath
  123. *
  124. * @return bool
  125. */
  126. public function rename($path, $newpath);
  127. /**
  128. * Copy a file.
  129. *
  130. * @param string $path
  131. * @param string $newpath
  132. *
  133. * @return bool
  134. */
  135. public function copy($path, $newpath);
  136. /**
  137. * Delete a file.
  138. *
  139. * @param string $path
  140. *
  141. * @return bool
  142. */
  143. public function delete($path);
  144. /**
  145. * Delete a directory.
  146. *
  147. * @param string $dirname
  148. *
  149. * @return bool
  150. */
  151. public function deleteDir($dirname);
  152. /**
  153. * Create a directory.
  154. *
  155. * @param string $dirname directory name
  156. * @param array $config
  157. *
  158. * @return bool
  159. */
  160. public function createDir($dirname, array $config = []);
  161. /**
  162. * Set the visibility for a file.
  163. *
  164. * @param string $path
  165. * @param string $visibility
  166. *
  167. * @return bool success boolean
  168. */
  169. public function setVisibility($path, $visibility);
  170. /**
  171. * Create a file or update if exists.
  172. *
  173. * @param string $path path to file
  174. * @param string $contents file contents
  175. * @param array $config
  176. *
  177. * @throws FileExistsException
  178. *
  179. * @return bool success boolean
  180. */
  181. public function put($path, $contents, array $config = []);
  182. /**
  183. * Create a file or update if exists using a stream.
  184. *
  185. * @param string $path
  186. * @param resource $resource
  187. * @param array $config
  188. *
  189. * @return bool success boolean
  190. */
  191. public function putStream($path, $resource, array $config = []);
  192. /**
  193. * Read and delete a file.
  194. *
  195. * @param string $path
  196. *
  197. * @throws FileNotFoundException
  198. *
  199. * @return string|false file contents
  200. */
  201. public function readAndDelete($path);
  202. /**
  203. * Get a file/directory handler.
  204. *
  205. * @param string $path
  206. * @param Handler $handler
  207. *
  208. * @return Handler file or directory handler
  209. */
  210. public function get($path, Handler $handler = null);
  211. /**
  212. * Register a plugin.
  213. *
  214. * @param PluginInterface $plugin
  215. *
  216. * @return $this
  217. */
  218. public function addPlugin(PluginInterface $plugin);
  219. }