ISimpleFolder.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCP\Files\SimpleFS;
  7. use OCP\Files\NotFoundException;
  8. use OCP\Files\NotPermittedException;
  9. /**
  10. * Interface ISimpleFolder
  11. *
  12. * @since 11.0.0
  13. */
  14. interface ISimpleFolder {
  15. /**
  16. * Get all the files in a folder
  17. *
  18. * @return ISimpleFile[]
  19. * @since 11.0.0
  20. */
  21. public function getDirectoryListing(): array;
  22. /**
  23. * Check if a file with $name exists
  24. *
  25. * @param string $name
  26. * @return bool
  27. * @since 11.0.0
  28. */
  29. public function fileExists(string $name): bool;
  30. /**
  31. * Get the file named $name from the folder
  32. *
  33. * @throws NotFoundException
  34. * @since 11.0.0
  35. */
  36. public function getFile(string $name): ISimpleFile;
  37. /**
  38. * Creates a new file with $name in the folder
  39. *
  40. * @param string|resource|null $content @since 19.0.0
  41. * @throws NotPermittedException
  42. * @since 11.0.0
  43. */
  44. public function newFile(string $name, $content = null): ISimpleFile;
  45. /**
  46. * Remove the folder and all the files in it
  47. *
  48. * @throws NotPermittedException
  49. * @since 11.0.0
  50. */
  51. public function delete(): void;
  52. /**
  53. * Get the folder name
  54. *
  55. * @since 11.0.0
  56. */
  57. public function getName(): string;
  58. /**
  59. * Get the folder named $name from the current folder
  60. *
  61. * @throws NotFoundException
  62. * @since 25.0.0
  63. */
  64. public function getFolder(string $name): ISimpleFolder;
  65. /**
  66. * Creates a new folder with $name in the current folder
  67. *
  68. * @param string|resource|null $content @since 19.0.0
  69. * @throws NotPermittedException
  70. * @since 25.0.0
  71. */
  72. public function newFolder(string $path): ISimpleFolder;
  73. }