Filesystem.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. namespace Illuminate\Contracts\Filesystem;
  3. interface Filesystem
  4. {
  5. /**
  6. * The public visibility setting.
  7. *
  8. * @var string
  9. */
  10. const VISIBILITY_PUBLIC = 'public';
  11. /**
  12. * The private visibility setting.
  13. *
  14. * @var string
  15. */
  16. const VISIBILITY_PRIVATE = 'private';
  17. /**
  18. * Determine if a file exists.
  19. *
  20. * @param string $path
  21. * @return bool
  22. */
  23. public function exists($path);
  24. /**
  25. * Get the contents of a file.
  26. *
  27. * @param string $path
  28. * @return string
  29. *
  30. * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  31. */
  32. public function get($path);
  33. /**
  34. * Write the contents of a file.
  35. *
  36. * @param string $path
  37. * @param string|resource $contents
  38. * @param mixed $options
  39. * @return bool
  40. */
  41. public function put($path, $contents, $options = []);
  42. /**
  43. * Get the visibility for the given path.
  44. *
  45. * @param string $path
  46. * @return string
  47. */
  48. public function getVisibility($path);
  49. /**
  50. * Set the visibility for the given path.
  51. *
  52. * @param string $path
  53. * @param string $visibility
  54. * @return void
  55. */
  56. public function setVisibility($path, $visibility);
  57. /**
  58. * Prepend to a file.
  59. *
  60. * @param string $path
  61. * @param string $data
  62. * @return int
  63. */
  64. public function prepend($path, $data);
  65. /**
  66. * Append to a file.
  67. *
  68. * @param string $path
  69. * @param string $data
  70. * @return int
  71. */
  72. public function append($path, $data);
  73. /**
  74. * Delete the file at a given path.
  75. *
  76. * @param string|array $paths
  77. * @return bool
  78. */
  79. public function delete($paths);
  80. /**
  81. * Copy a file to a new location.
  82. *
  83. * @param string $from
  84. * @param string $to
  85. * @return bool
  86. */
  87. public function copy($from, $to);
  88. /**
  89. * Move a file to a new location.
  90. *
  91. * @param string $from
  92. * @param string $to
  93. * @return bool
  94. */
  95. public function move($from, $to);
  96. /**
  97. * Get the file size of a given file.
  98. *
  99. * @param string $path
  100. * @return int
  101. */
  102. public function size($path);
  103. /**
  104. * Get the file's last modification time.
  105. *
  106. * @param string $path
  107. * @return int
  108. */
  109. public function lastModified($path);
  110. /**
  111. * Get an array of all files in a directory.
  112. *
  113. * @param string|null $directory
  114. * @param bool $recursive
  115. * @return array
  116. */
  117. public function files($directory = null, $recursive = false);
  118. /**
  119. * Get all of the files from the given directory (recursive).
  120. *
  121. * @param string|null $directory
  122. * @return array
  123. */
  124. public function allFiles($directory = null);
  125. /**
  126. * Get all of the directories within a given directory.
  127. *
  128. * @param string|null $directory
  129. * @param bool $recursive
  130. * @return array
  131. */
  132. public function directories($directory = null, $recursive = false);
  133. /**
  134. * Get all (recursive) of the directories within a given directory.
  135. *
  136. * @param string|null $directory
  137. * @return array
  138. */
  139. public function allDirectories($directory = null);
  140. /**
  141. * Create a directory.
  142. *
  143. * @param string $path
  144. * @return bool
  145. */
  146. public function makeDirectory($path);
  147. /**
  148. * Recursively delete a directory.
  149. *
  150. * @param string $directory
  151. * @return bool
  152. */
  153. public function deleteDirectory($directory);
  154. }