ISimpleFolder.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
  4. *
  5. * @author Robin Appelman <robin@icewind.nl>
  6. * @author Roeland Jago Douma <roeland@famdouma.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Files\SimpleFS;
  25. use OCP\Files\NotFoundException;
  26. use OCP\Files\NotPermittedException;
  27. /**
  28. * Interface ISimpleFolder
  29. *
  30. * @since 11.0.0
  31. */
  32. interface ISimpleFolder {
  33. /**
  34. * Get all the files in a folder
  35. *
  36. * @return ISimpleFile[]
  37. * @since 11.0.0
  38. */
  39. public function getDirectoryListing(): array;
  40. /**
  41. * Check if a file with $name exists
  42. *
  43. * @param string $name
  44. * @return bool
  45. * @since 11.0.0
  46. */
  47. public function fileExists(string $name): bool;
  48. /**
  49. * Get the file named $name from the folder
  50. *
  51. * @throws NotFoundException
  52. * @since 11.0.0
  53. */
  54. public function getFile(string $name): ISimpleFile;
  55. /**
  56. * Creates a new file with $name in the folder
  57. *
  58. * @param string|resource|null $content @since 19.0.0
  59. * @throws NotPermittedException
  60. * @since 11.0.0
  61. */
  62. public function newFile(string $name, $content = null): ISimpleFile;
  63. /**
  64. * Remove the folder and all the files in it
  65. *
  66. * @throws NotPermittedException
  67. * @since 11.0.0
  68. */
  69. public function delete(): void;
  70. /**
  71. * Get the folder name
  72. *
  73. * @since 11.0.0
  74. */
  75. public function getName(): string;
  76. /**
  77. * Get the folder named $name from the current folder
  78. *
  79. * @throws NotFoundException
  80. * @since 25.0.0
  81. */
  82. public function getFolder(string $name): ISimpleFolder;
  83. /**
  84. * Creates a new folder with $name in the current folder
  85. *
  86. * @param string|resource|null $content @since 19.0.0
  87. * @throws NotPermittedException
  88. * @since 25.0.0
  89. */
  90. public function newFolder(string $path): ISimpleFolder;
  91. }