UploadFile.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Upload;
  8. use OCA\DAV\Connector\Sabre\File;
  9. use Sabre\DAV\IFile;
  10. class UploadFile implements IFile {
  11. public function __construct(
  12. private File $file,
  13. ) {
  14. }
  15. public function put($data) {
  16. return $this->file->put($data);
  17. }
  18. public function get() {
  19. return $this->file->get();
  20. }
  21. public function getId() {
  22. return $this->file->getId();
  23. }
  24. public function getContentType() {
  25. return $this->file->getContentType();
  26. }
  27. public function getETag() {
  28. return $this->file->getETag();
  29. }
  30. /**
  31. * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit
  32. * @return int|float
  33. */
  34. public function getSize() {
  35. return $this->file->getSize();
  36. }
  37. public function delete() {
  38. $this->file->delete();
  39. }
  40. public function getName() {
  41. return $this->file->getName();
  42. }
  43. public function setName($name) {
  44. $this->file->setName($name);
  45. }
  46. public function getLastModified() {
  47. return $this->file->getLastModified();
  48. }
  49. public function getInternalPath(): string {
  50. return $this->file->getInternalPath();
  51. }
  52. public function getFile(): File {
  53. return $this->file;
  54. }
  55. public function getNode() {
  56. return $this->file->getNode();
  57. }
  58. }