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