Make MDPlausiLegalCheckResultType implement MDValueInterface

This commit is contained in:
2026-07-13 17:15:34 +02:00
parent d83f15fa56
commit aebf0b8fae
@@ -10,7 +10,7 @@ declare(strict_types = 1);
/** /**
* Represents a possible status for to-dos. * Represents a possible status for to-dos.
*/ */
enum MDPlausiLegalCheckResultType implements JsonSerializable { enum MDPlausiLegalCheckResultType implements MDValueEnumInterface, JsonSerializable {
case expect_public_domain; case expect_public_domain;
case expect_restricted_legal_status; 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<string, string>
*/
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<string, string>
*/
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(). * Provides the option to serialize as a string during json_encode().
* *