-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathFileStatusService.php
More file actions
32 lines (26 loc) · 743 Bytes
/
FileStatusService.php
File metadata and controls
32 lines (26 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Libresign\Service;
use OCA\Libresign\Db\File as FileEntity;
use OCA\Libresign\Db\FileMapper;
class FileStatusService {
public function __construct(
private FileMapper $fileMapper,
) {
}
public function updateFileStatusIfUpgrade(FileEntity $file, int $newStatus): FileEntity {
$currentStatus = $file->getStatus();
if ($newStatus > $currentStatus) {
$file->setStatus($newStatus);
$this->fileMapper->update($file);
}
return $file;
}
public function canNotifySigners(?int $fileStatus): bool {
return $fileStatus === FileEntity::STATUS_ABLE_TO_SIGN;
}
}