-
-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathSignatureFlow.php
More file actions
36 lines (29 loc) · 853 Bytes
/
SignatureFlow.php
File metadata and controls
36 lines (29 loc) · 853 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
33
34
35
36
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Libresign\Enum;
/**
* Signature flow modes
*/
enum SignatureFlow: string {
case PARALLEL = 'parallel';
case ORDERED_NUMERIC = 'ordered_numeric';
public const NUMERIC_PARALLEL = 1;
public const NUMERIC_ORDERED_NUMERIC = 2;
public function toNumeric(): int {
return match($this) {
self::PARALLEL => self::NUMERIC_PARALLEL,
self::ORDERED_NUMERIC => self::NUMERIC_ORDERED_NUMERIC,
};
}
public static function fromNumeric(int $value): self {
return match($value) {
self::NUMERIC_PARALLEL => self::PARALLEL,
self::NUMERIC_ORDERED_NUMERIC => self::ORDERED_NUMERIC,
default => throw new \ValueError("Invalid numeric value for SignatureFlow: $value"),
};
}
}