ICollection.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sabre\DAV;
  4. /**
  5. * The ICollection Interface.
  6. *
  7. * This interface should be implemented by each class that represents a collection
  8. *
  9. * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
  10. * @author Evert Pot (http://evertpot.com/)
  11. * @license http://sabre.io/license/ Modified BSD License
  12. */
  13. interface ICollection extends INode
  14. {
  15. /**
  16. * Creates a new file in the directory.
  17. *
  18. * Data will either be supplied as a stream resource, or in certain cases
  19. * as a string. Keep in mind that you may have to support either.
  20. *
  21. * After successful creation of the file, you may choose to return the ETag
  22. * of the new file here.
  23. *
  24. * The returned ETag must be surrounded by double-quotes (The quotes should
  25. * be part of the actual string).
  26. *
  27. * If you cannot accurately determine the ETag, you should not return it.
  28. * If you don't store the file exactly as-is (you're transforming it
  29. * somehow) you should also not return an ETag.
  30. *
  31. * This means that if a subsequent GET to this new file does not exactly
  32. * return the same contents of what was submitted here, you are strongly
  33. * recommended to omit the ETag.
  34. *
  35. * @param string $name Name of the file
  36. * @param resource|string $data Initial payload
  37. *
  38. * @return string|null
  39. */
  40. public function createFile($name, $data = null);
  41. /**
  42. * Creates a new subdirectory.
  43. *
  44. * @param string $name
  45. */
  46. public function createDirectory($name);
  47. /**
  48. * Returns a specific child node, referenced by its name.
  49. *
  50. * This method must throw Sabre\DAV\Exception\NotFound if the node does not
  51. * exist.
  52. *
  53. * @param string $name
  54. *
  55. * @return INode
  56. */
  57. public function getChild($name);
  58. /**
  59. * Returns an array with all the child nodes.
  60. *
  61. * @return INode[]
  62. */
  63. public function getChildren();
  64. /**
  65. * Checks if a child-node with the specified name exists.
  66. *
  67. * @param string $name
  68. *
  69. * @return bool
  70. */
  71. public function childExists($name);
  72. }