Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| CertificateEngineType | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| getEngineName | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
| tryFromValue | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Enum; |
| 10 | |
| 11 | enum CertificateEngineType: string { |
| 12 | case OpenSSL = 'o'; |
| 13 | case CFSSL = 'c'; |
| 14 | |
| 15 | public function getEngineName(): string { |
| 16 | return match($this) { |
| 17 | self::OpenSSL => 'openssl', |
| 18 | self::CFSSL => 'cfssl', |
| 19 | }; |
| 20 | } |
| 21 | |
| 22 | public static function tryFromValue(mixed $value): ?self { |
| 23 | return match($value) { |
| 24 | 'o', 'openssl' => self::OpenSSL, |
| 25 | 'c', 'cfssl' => self::CFSSL, |
| 26 | default => null, |
| 27 | }; |
| 28 | } |
| 29 | } |