• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 20041337954

08 Dec 2025 08:09PM UTC coverage: 44.146%. First build
20041337954

Pull #6021

github

web-flow
Merge 0668e31e8 into eb7183cb5
Pull Request #6021: feat: docmdp implementation

66 of 113 new or added lines in 10 files covered. (58.41%)

5678 of 12862 relevant lines covered (44.15%)

5.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

5.0
/lib/Service/DocMdpConfigService.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
7
 * SPDX-License-Identifier: AGPL-3.0-or-later
8
 */
9

10
namespace OCA\Libresign\Service;
11

12
use OCA\Libresign\AppInfo\Application;
13
use OCA\Libresign\Enum\DocMdpLevel;
14
use OCP\IAppConfig;
15
use OCP\IL10N;
16

17
class DocMdpConfigService {
18
        private const CONFIG_KEY_LEVEL = 'docmdp_level';
19

20
        public function __construct(
21
                private IAppConfig $appConfig,
22
                private IL10N $l10n,
23
        ) {
24
        }
6✔
25

26
        public function isEnabled(): bool {
NEW
27
                return $this->appConfig->hasKey(Application::APP_ID, self::CONFIG_KEY_LEVEL);
×
28
        }
29

30
        public function setEnabled(bool $enabled): void {
NEW
31
                if (!$enabled) {
×
NEW
32
                        $this->appConfig->deleteKey(Application::APP_ID, self::CONFIG_KEY_LEVEL);
×
33
                }
34
        }
35

36
        public function getLevel(): DocMdpLevel {
NEW
37
                $level = $this->appConfig->getValueInt(Application::APP_ID, self::CONFIG_KEY_LEVEL, DocMdpLevel::NOT_CERTIFIED->value);
×
NEW
38
                return DocMdpLevel::from($level);
×
39
        }
40

41
        public function setLevel(DocMdpLevel $level): void {
NEW
42
                $this->appConfig->setValueInt(Application::APP_ID, self::CONFIG_KEY_LEVEL, $level->value);
×
43
        }
44

45
        public function getConfig(): array {
NEW
46
                return [
×
NEW
47
                        'enabled' => $this->isEnabled(),
×
NEW
48
                        'defaultLevel' => $this->getLevel()->value,
×
NEW
49
                        'availableLevels' => $this->getAvailableLevels(),
×
NEW
50
                ];
×
51
        }
52

53
        private function getAvailableLevels(): array {
NEW
54
                return array_map(
×
NEW
55
                        fn (DocMdpLevel $level) => [
×
NEW
56
                                'value' => $level->value,
×
NEW
57
                                'label' => $level->getLabel($this->l10n),
×
NEW
58
                                'description' => $level->getDescription($this->l10n),
×
NEW
59
                        ],
×
NEW
60
                        DocMdpLevel::cases()
×
NEW
61
                );
×
62
        }
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc