UploadFile.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /** @var File */
  12. private $file;
  13. public function __construct(File $file) {
  14. $this->file = $file;
  15. }
  16. public function put($data) {
  17. return $this->file->put($data);
  18. }
  19. public function get() {
  20. return $this->file->get();
  21. }
  22. public function getId() {
  23. return $this->file->getId();
  24. }
  25. public function getContentType() {
  26. return $this->file->getContentType();
  27. }
  28. public function getETag() {
  29. return $this->file->getETag();
  30. }
  31. /**
  32. * @psalm-suppress ImplementedReturnTypeMismatch \Sabre\DAV\IFile::getSize signature does not support 32bit
  33. * @return int|float
  34. */
  35. public function getSize() {
  36. return $this->file->getSize();
  37. }
  38. public function delete() {
  39. $this->file->delete();
  40. }
  41. public function getName() {
  42. return $this->file->getName();
  43. }
  44. public function setName($name) {
  45. $this->file->setName($name);
  46. }
  47. public function getLastModified() {
  48. return $this->file->getLastModified();
  49. }
  50. public function getInternalPath(): string {
  51. return $this->file->getInternalPath();
  52. }
  53. public function getFile(): File {
  54. return $this->file;
  55. }
  56. public function getNode() {
  57. return $this->file->getNode();
  58. }
  59. }