*/ declare(strict_types = 1); /** * Represents a possible status for to-dos. */ enum MDInstitutionExternalIdRepository implements MDValueEnumInterface, JsonSerializable { case hu_ksh; // https://en.wikipedia.org/wiki/Hungarian_Central_Statistical_Office private const VALIDATION_PATTERN_HTML = [ 'hu_ksh' => '[0-9]{8}-[0-9]{4}-[0-9]{3}-[0-9]{2}', ]; private const VALIDATION_PATTERN_PHP = [ 'hu_ksh' => '/^[0-9]{8}-[0-9]{4}-[0-9]{3}-[0-9]{2}$/', ]; /** * Returns a value of this type based on a string. * * @param string $input Input to get a value from. * * @return MDInstitutionExternalIdRepository */ public static function fromString(string $input):MDInstitutionExternalIdRepository { return match($input) { 'hu_ksh' => self::hu_ksh, default => throw new MDpageParameterNotFromListException("Unknown external repository"), }; } /** * Lists all available names. * * @return array */ public static function caseNames():array { $output = []; $cases = self::cases(); foreach ($cases as $case) { $output[] = $case->name; } return $output; } /** * 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 { return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "institution_external_id_repositories", "institution_external_id_repositories"); } /** * 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 { return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "institution_external_id_repositories", "institution_external_id_repositories"); } /** * Returns the name of the current value in translation. * * @param MDTlLoader $tlLoader Translation loader. * * @return string */ public function getTledName(MDTlLoader $tlLoader):string { return $tlLoader->tl("institution_external_id_repositories", "institution_external_id_repositories", $this->name); } /** * Returns the HTML pattern. * * @return string */ public function getValidationPatternHtml():string { return self::VALIDATION_PATTERN_HTML[$this->name]; } /** * Returns the PHP pattern. * * @return string */ public function getValidationPatternPhp():string { return self::VALIDATION_PATTERN_PHP[$this->name]; } /** * Provides the option to serialize as a string during json_encode(). * * @return string */ public function jsonSerialize():string { return $this->name; } }