. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Elements; use function strtolower; /** * ROMANIZED_TYPE := {Size=5:30} * [ | pinyin | romaji | wadegiles] * Indicates the method used in transforming the text to a romanized variation. */ class RomanizedType extends AbstractElement { protected const MAX_LENGTH = 30; /** * Convert a value to a canonical form. * * @param string $value * * @return string */ public function canonical(string $value): string { $value = parent::canonical($value); $lower = strtolower($value); if ($lower === 'pinyin' || $lower === 'romaji' || $lower === 'wadegiles') { return $lower; } return $value; } }