Version.php 2.4 KB

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