Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| MetricDefinition | |
100.00% |
3 / 3 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| id | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| isSnapshot | |
100.00% |
1 / 1 |
|
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\Service\UsageStatistics\Model; |
| 10 | |
| 11 | final class MetricDefinition { |
| 12 | public const KIND_SNAPSHOT = 'snapshot'; |
| 13 | public const KIND_PERIOD = 'period'; |
| 14 | |
| 15 | public function __construct( |
| 16 | public readonly string $category, |
| 17 | public readonly string $key, |
| 18 | public readonly string $type, |
| 19 | public readonly string $kind, |
| 20 | public readonly string $aggregation, |
| 21 | public readonly string $description, |
| 22 | public readonly bool $required, |
| 23 | ) { |
| 24 | } |
| 25 | |
| 26 | public function id(): string { |
| 27 | return $this->category . '.' . $this->key; |
| 28 | } |
| 29 | |
| 30 | public function isSnapshot(): bool { |
| 31 | return $this->kind === self::KIND_SNAPSHOT; |
| 32 | } |
| 33 | } |