IPatchSupport.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. declare(strict_types=1);
  3. namespace Sabre\DAV\PartialUpdate;
  4. use Sabre\DAV;
  5. /**
  6. * This interface provides a way to modify only part of a target resource
  7. * It may be used to update a file chunk, upload big a file into smaller
  8. * chunks or resume an upload.
  9. *
  10. * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
  11. * @author Jean-Tiare LE BIGOT (http://www.jtlebi.fr/)
  12. * @license http://sabre.io/license/ Modified BSD License
  13. */
  14. interface IPatchSupport extends DAV\IFile
  15. {
  16. /**
  17. * Updates the file based on a range specification.
  18. *
  19. * The first argument is the data, which is either a readable stream
  20. * resource or a string.
  21. *
  22. * The second argument is the type of update we're doing.
  23. * This is either:
  24. * * 1. append
  25. * * 2. update based on a start byte
  26. * * 3. update based on an end byte
  27. *;
  28. * The third argument is the start or end byte.
  29. *
  30. * After a successful put operation, you may choose to return an ETag. The
  31. * etag must always be surrounded by double-quotes. These quotes must
  32. * appear in the actual string you're returning.
  33. *
  34. * Clients may use the ETag from a PUT request to later on make sure that
  35. * when they update the file, the contents haven't changed in the mean
  36. * time.
  37. *
  38. * @param resource|string $data
  39. * @param int $rangeType
  40. * @param int $offset
  41. *
  42. * @return string|null
  43. */
  44. public function patch($data, $rangeType, $offset = null);
  45. }