From aebf0b8faef66ba096928caba9c8e7f7fdd50ab3 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Mon, 13 Jul 2026 17:15:34 +0200 Subject: [PATCH] Make MDPlausiLegalCheckResultType implement MDValueInterface --- .../MDPlausiLegalCheckResultType.php | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/Checks/PlausiForLegalStatus/MDPlausiLegalCheckResultType.php b/src/Checks/PlausiForLegalStatus/MDPlausiLegalCheckResultType.php index 106e1e1..532e2f5 100644 --- a/src/Checks/PlausiForLegalStatus/MDPlausiLegalCheckResultType.php +++ b/src/Checks/PlausiForLegalStatus/MDPlausiLegalCheckResultType.php @@ -10,7 +10,7 @@ declare(strict_types = 1); /** * Represents a possible status for to-dos. */ -enum MDPlausiLegalCheckResultType implements JsonSerializable { +enum MDPlausiLegalCheckResultType implements MDValueEnumInterface, JsonSerializable { case expect_public_domain; case expect_restricted_legal_status; @@ -95,6 +95,51 @@ enum MDPlausiLegalCheckResultType implements JsonSerializable { } + /** + * Returns the name of the current value in translation. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return string + */ + public function getTledName(MDTlLoader $tlLoader):string { + + return $this->getTl($tlLoader); + + } + + /** + * Gets an unsorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getUnsortedList(MDTlLoader $tlLoader):array { + + $output = []; + foreach (self::cases() as $case) { + $output[$case->name] = $case->getTledName($tlLoader); + }; + return $output; + + } + + /** + * Gets a sorted list of the entries in a translated version. + * + * @param MDTlLoader $tlLoader Translation loader. + * + * @return array + */ + public static function getSortedList(MDTlLoader $tlLoader):array { + + $output = self::getUnsortedList($tlLoader); + asort($output); + return $output; + + } + /** * Provides the option to serialize as a string during json_encode(). *