2018-10-12 11:42:08 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-10-12 11:42:08 -04:00
|
|
|
declare(strict_types=1);
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-10-12 11:42:08 -04:00
|
|
|
/**
|
|
|
|
|
* @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl>
|
|
|
|
|
*
|
2019-12-03 13:57:53 -05:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
|
*
|
2018-10-12 11:42:08 -04:00
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2021-06-04 15:52:51 -04:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2018-10-12 11:42:08 -04:00
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
2019-12-03 13:57:53 -05:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2018-10-12 11:42:08 -04:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
namespace OCA\Files_Versions\Versions;
|
|
|
|
|
|
|
|
|
|
use OCP\Files\FileInfo;
|
|
|
|
|
use OCP\IUser;
|
|
|
|
|
|
2024-03-13 09:54:15 -04:00
|
|
|
class Version implements IVersion, IMetadataVersion {
|
2018-10-12 11:42:08 -04:00
|
|
|
public function __construct(
|
2024-03-13 09:54:15 -04:00
|
|
|
private int $timestamp,
|
|
|
|
|
private int|string $revisionId,
|
|
|
|
|
private string $name,
|
|
|
|
|
private int|float $size,
|
|
|
|
|
private string $mimetype,
|
|
|
|
|
private string $path,
|
|
|
|
|
private FileInfo $sourceFileInfo,
|
|
|
|
|
private IVersionBackend $backend,
|
|
|
|
|
private IUser $user,
|
|
|
|
|
private array $metadata = [],
|
2018-10-12 11:42:08 -04:00
|
|
|
) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getBackend(): IVersionBackend {
|
|
|
|
|
return $this->backend;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSourceFile(): FileInfo {
|
|
|
|
|
return $this->sourceFileInfo;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-04 07:39:23 -04:00
|
|
|
public function getRevisionId() {
|
2018-10-12 11:42:08 -04:00
|
|
|
return $this->revisionId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getTimestamp(): int {
|
|
|
|
|
return $this->timestamp;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-30 10:15:45 -05:00
|
|
|
public function getSize(): int|float {
|
2018-10-12 11:42:08 -04:00
|
|
|
return $this->size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getSourceFileName(): string {
|
|
|
|
|
return $this->name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getMimeType(): string {
|
|
|
|
|
return $this->mimetype;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getVersionPath(): string {
|
|
|
|
|
return $this->path;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getUser(): IUser {
|
|
|
|
|
return $this->user;
|
|
|
|
|
}
|
2024-03-09 12:05:25 -05:00
|
|
|
|
2024-03-26 07:21:56 -04:00
|
|
|
public function getMetadata(): array {
|
|
|
|
|
return $this->metadata;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 09:11:53 -04:00
|
|
|
public function getMetadataValue(string $key): ?string {
|
2024-03-13 09:54:15 -04:00
|
|
|
return $this->metadata[$key] ?? null;
|
2024-03-09 12:05:25 -05:00
|
|
|
}
|
2018-10-12 11:42:08 -04:00
|
|
|
}
|