1
0

Version.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCA\Files_Versions\Versions;
  23. use OCP\Files\FileInfo;
  24. use OCP\IUser;
  25. class Version implements IVersion {
  26. /** @var int */
  27. private $timestamp;
  28. /** @var int|string */
  29. private $revisionId;
  30. /** @var string */
  31. private $name;
  32. /** @var int */
  33. private $size;
  34. /** @var string */
  35. private $mimetype;
  36. /** @var string */
  37. private $path;
  38. /** @var FileInfo */
  39. private $sourceFileInfo;
  40. /** @var IVersionBackend */
  41. private $backend;
  42. /** @var IUser */
  43. private $user;
  44. public function __construct(
  45. int $timestamp,
  46. $revisionId,
  47. string $name,
  48. int $size,
  49. string $mimetype,
  50. string $path,
  51. FileInfo $sourceFileInfo,
  52. IVersionBackend $backend,
  53. IUser $user
  54. ) {
  55. $this->timestamp = $timestamp;
  56. $this->revisionId = $revisionId;
  57. $this->name = $name;
  58. $this->size = $size;
  59. $this->mimetype = $mimetype;
  60. $this->path = $path;
  61. $this->sourceFileInfo = $sourceFileInfo;
  62. $this->backend = $backend;
  63. $this->user = $user;
  64. }
  65. public function getBackend(): IVersionBackend {
  66. return $this->backend;
  67. }
  68. public function getSourceFile(): FileInfo {
  69. return $this->sourceFileInfo;
  70. }
  71. public function getRevisionId() {
  72. return $this->revisionId;
  73. }
  74. public function getTimestamp(): int {
  75. return $this->timestamp;
  76. }
  77. public function getSize(): int {
  78. return $this->size;
  79. }
  80. public function getSourceFileName(): string {
  81. return $this->name;
  82. }
  83. public function getMimeType(): string {
  84. return $this->mimetype;
  85. }
  86. public function getVersionPath(): string {
  87. return $this->path;
  88. }
  89. public function getUser(): IUser {
  90. return $this->user;
  91. }
  92. }