Skip to content

Commit aac3388

Browse files
committed
refactor: remove duplicate methods and improve DocMDP descriptions
- Remove duplicate getLabel() and getDescription() methods from DocMdpConfigService - Use enum methods directly by passing IL10N instance - Improve descriptions to differentiate between approval and certifying signatures - Align descriptions with ISO 32000 DocMDP specification terminology The new descriptions clearly distinguish: - Approval signature (NOT_CERTIFIED): allows all modifications - Certifying signature (levels 1-3): restricts modifications based on level Signed-off-by: Vitor Mattos <[email protected]>
1 parent 250cddc commit aac3388

2 files changed

Lines changed: 6 additions & 24 deletions

File tree

lib/Enum/DocMdpLevel.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public function getLabel(IL10N $l10n): string {
3232

3333
public function getDescription(IL10N $l10n): string {
3434
return match($this) {
35-
self::NOT_CERTIFIED => $l10n->t('Document is not certified. No restrictions on modifications.'),
36-
self::CERTIFIED_NO_CHANGES_ALLOWED => $l10n->t('No changes allowed. Additional approval signatures are prohibited.'),
37-
self::CERTIFIED_FORM_FILLING => $l10n->t('Form filling allowed. Additional approval signatures are allowed.'),
38-
self::CERTIFIED_FORM_FILLING_AND_ANNOTATIONS => $l10n->t('Form filling and annotations allowed. Additional approval signatures are allowed.'),
35+
self::NOT_CERTIFIED => $l10n->t('Approval signature - allows all modifications'),
36+
self::CERTIFIED_NO_CHANGES_ALLOWED => $l10n->t('Certifying signature - no modifications or additional signatures allowed'),
37+
self::CERTIFIED_FORM_FILLING => $l10n->t('Certifying signature - allows form filling and additional approval signatures'),
38+
self::CERTIFIED_FORM_FILLING_AND_ANNOTATIONS => $l10n->t('Certifying signature - allows form filling, comments and additional approval signatures'),
3939
};
4040
}
4141
}

lib/Service/DocMdpConfigService.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,10 @@ private function getAvailableLevels(): array {
5454
return array_map(
5555
fn (DocMdpLevel $level) => [
5656
'value' => $level->value,
57-
'label' => $this->getLabel($level),
58-
'description' => $this->getDescription($level),
57+
'label' => $level->getLabel($this->l10n),
58+
'description' => $level->getDescription($this->l10n),
5959
],
6060
DocMdpLevel::cases()
6161
);
6262
}
63-
64-
private function getLabel(DocMdpLevel $level): string {
65-
return match ($level) {
66-
DocMdpLevel::NOT_CERTIFIED => $this->l10n->t('No certification'),
67-
DocMdpLevel::CERTIFIED_NO_CHANGES_ALLOWED => $this->l10n->t('No changes allowed'),
68-
DocMdpLevel::CERTIFIED_FORM_FILLING => $this->l10n->t('Form filling and additional signatures'),
69-
DocMdpLevel::CERTIFIED_FORM_FILLING_AND_ANNOTATIONS => $this->l10n->t('Form filling, annotations and additional signatures'),
70-
};
71-
}
72-
73-
private function getDescription(DocMdpLevel $level): string {
74-
return match ($level) {
75-
DocMdpLevel::NOT_CERTIFIED => $this->l10n->t('Approval signature - allows all modifications'),
76-
DocMdpLevel::CERTIFIED_NO_CHANGES_ALLOWED => $this->l10n->t('Certifying signature - no modifications or additional signatures allowed'),
77-
DocMdpLevel::CERTIFIED_FORM_FILLING => $this->l10n->t('Certifying signature - allows form filling and additional approval signatures'),
78-
DocMdpLevel::CERTIFIED_FORM_FILLING_AND_ANNOTATIONS => $this->l10n->t('Certifying signature - allows form filling, comments and additional approval signatures'),
79-
};
80-
}
8163
}

0 commit comments

Comments
 (0)