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
|
|
|
/**
|
2024-06-02 09:26:54 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
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
|
|
|
}
|