1c2ed51d1SGreg Roach<?php 2c2ed51d1SGreg Roach 3c2ed51d1SGreg Roach/** 4c2ed51d1SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6c2ed51d1SGreg Roach * This program is free software: you can redistribute it and/or modify 7c2ed51d1SGreg Roach * it under the terms of the GNU General Public License as published by 8c2ed51d1SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9c2ed51d1SGreg Roach * (at your option) any later version. 10c2ed51d1SGreg Roach * This program is distributed in the hope that it will be useful, 11c2ed51d1SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12c2ed51d1SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13c2ed51d1SGreg Roach * GNU General Public License for more details. 14c2ed51d1SGreg Roach * You should have received a copy of the GNU General Public License 15c2ed51d1SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16c2ed51d1SGreg Roach */ 17c2ed51d1SGreg Roach 18c2ed51d1SGreg Roachdeclare(strict_types=1); 19c2ed51d1SGreg Roach 20c2ed51d1SGreg Roachnamespace Fisharebest\Webtrees\Elements; 21c2ed51d1SGreg Roach 22c2ed51d1SGreg Roachuse Fisharebest\Webtrees\I18N; 23c2ed51d1SGreg Roach 248939e2c2SGreg Roachuse function strtoupper; 258939e2c2SGreg Roach 26c2ed51d1SGreg Roach/** 27c2ed51d1SGreg Roach * NAME_TYPE := {Size=5:30} 28c2ed51d1SGreg Roach * [ aka | birth | immigrant | maiden | married | <user defined>] 29c2ed51d1SGreg Roach * Indicates the name type, for example the name issued or assumed as an immigrant. 30c2ed51d1SGreg Roach * aka = also known as, alias, etc. 31c2ed51d1SGreg Roach * birth = name given on birth certificate. 32c2ed51d1SGreg Roach * immigrant = name assumed at the time of immigration. 33c2ed51d1SGreg Roach * maiden = maiden name, name before first marriage. 34c2ed51d1SGreg Roach * married =name was persons previous married name. 35c2ed51d1SGreg Roach * user_defined = other text name that defines the name type. 36c2ed51d1SGreg Roach */ 37c2ed51d1SGreg Roachclass NameType extends AbstractElement 38c2ed51d1SGreg Roach{ 3988a03560SGreg Roach public const VALUE_ADOPTED = 'ADOPTED'; 4088a03560SGreg Roach public const VALUE_AKA = 'AKA'; 4188a03560SGreg Roach public const VALUE_BIRTH = 'BIRTH'; 4288a03560SGreg Roach public const VALUE_CHANGE = 'CHANGE'; 4388a03560SGreg Roach public const VALUE_ESTATE = 'ESTATE'; 4488a03560SGreg Roach public const VALUE_IMMIGRANT = 'IMMIGRANT'; 4588a03560SGreg Roach public const VALUE_MAIDEN = 'MAIDEN'; 4688a03560SGreg Roach public const VALUE_MARRIED = 'MARRIED'; 4788a03560SGreg Roach public const VALUE_RELIGIOUS = 'RELIGIOUS'; 488939e2c2SGreg Roach 498939e2c2SGreg Roach /** 508939e2c2SGreg Roach * Convert a value to a canonical form. 518939e2c2SGreg Roach * 528939e2c2SGreg Roach * @param string $value 538939e2c2SGreg Roach * 548939e2c2SGreg Roach * @return string 558939e2c2SGreg Roach */ 568939e2c2SGreg Roach public function canonical(string $value): string 578939e2c2SGreg Roach { 588939e2c2SGreg Roach return strtoupper(parent::canonical($value)); 598939e2c2SGreg Roach } 607c29ac65SGreg Roach 61c2ed51d1SGreg Roach /** 62c2ed51d1SGreg Roach * A list of controlled values for this element 63c2ed51d1SGreg Roach * 64c2ed51d1SGreg Roach * @return array<int|string,string> 65c2ed51d1SGreg Roach */ 66c2ed51d1SGreg Roach public function values(): array 67c2ed51d1SGreg Roach { 68c2ed51d1SGreg Roach return [ 69c2ed51d1SGreg Roach '' => '', 707c29ac65SGreg Roach /* I18N: The name given to a child by its adoptive parents */ 7188a03560SGreg Roach self::VALUE_ADOPTED => I18N::translate('adopted name'), 727c29ac65SGreg Roach /* I18N: The name by which an individual is also known. e.g. a professional name or a stage name */ 7388a03560SGreg Roach self::VALUE_AKA => I18N::translate('also known as'), 747c29ac65SGreg Roach /* I18N: The name given to an individual at their birth */ 7588a03560SGreg Roach self::VALUE_BIRTH => I18N::translate('birth name'), 767c29ac65SGreg Roach /* I18N: A name chosen by an individual, to replace their existing name (whether legal or otherwise) */ 7788a03560SGreg Roach self::VALUE_CHANGE => I18N::translate('change of name'), 787c29ac65SGreg Roach /* I18N: A name given to an individual, from the farm or estate on which they lived or worked */ 7988a03560SGreg Roach self::VALUE_ESTATE => I18N::translate('estate name'), 807c29ac65SGreg Roach /* I18N: A name taken on immigration - e.g. migrants to the USA frequently anglicized their names */ 8188a03560SGreg Roach self::VALUE_IMMIGRANT => I18N::translate('immigration name'), 827c29ac65SGreg Roach /* I18N: A woman’s name, before she marries (in cultures where women take their new husband’s name on marriage) */ 8388a03560SGreg Roach self::VALUE_MAIDEN => I18N::translate('maiden name'), 847c29ac65SGreg Roach /* I18N: A name taken on marriage - usually the wife takes the husband’s surname */ 8588a03560SGreg Roach self::VALUE_MARRIED => I18N::translate('married name'), 867c29ac65SGreg Roach /* I18N: A name taken when entering a religion or a religious order */ 8788a03560SGreg Roach self::VALUE_RELIGIOUS => I18N::translate('religious name'), 88c2ed51d1SGreg Roach ]; 89c2ed51d1SGreg Roach } 90c2ed51d1SGreg Roach} 91