1323788f4SGreg Roach<?php 23976b470SGreg Roach 3323788f4SGreg Roach/** 4323788f4SGreg Roach * webtrees: online genealogy 58fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 6323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 7323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 8323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9323788f4SGreg Roach * (at your option) any later version. 10323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 11323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13323788f4SGreg Roach * GNU General Public License for more details. 14323788f4SGreg Roach * You should have received a copy of the GNU General Public License 15323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 16323788f4SGreg Roach */ 17*fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 20323788f4SGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 21323788f4SGreg Roach 22323788f4SGreg Roach/** 23323788f4SGreg Roach * All family members keep their original surname 24323788f4SGreg Roach */ 25c1010edaSGreg Roachclass DefaultSurnameTradition implements SurnameTraditionInterface 26c1010edaSGreg Roach{ 27323788f4SGreg Roach /** Extract a GIVN from a NAME */ 2816d6367aSGreg Roach protected const REGEX_GIVN = '~^(?<GIVN>[^/ ]+)~'; 29323788f4SGreg Roach 30323788f4SGreg Roach /** Extract a SPFX and SURN from a NAME */ 3116d6367aSGreg Roach protected const REGEX_SPFX_SURN = '~(?<NAME>/(?<SPFX>[a-z’\']{0,4}(?: [a-z’\']{1,4})*) ?(?<SURN>[^/]*)/)~'; 32323788f4SGreg Roach 33323788f4SGreg Roach /** Extract a simple SURN from a NAME */ 3416d6367aSGreg Roach protected const REGEX_SURN = '~(?<NAME>/(?<SURN>[^/]+)/)~'; 35323788f4SGreg Roach 36323788f4SGreg Roach /** Extract two Spanish/Portuguese SURNs from a NAME */ 3716d6367aSGreg Roach protected const REGEX_SURNS = '~/(?<SURN1>[^ /]+)(?: | y |/ /|/ y /)(?<SURN2>[^ /]+)/~'; 38323788f4SGreg Roach 39323788f4SGreg Roach /** 40323788f4SGreg Roach * Does this surname tradition change surname at marriage? 41323788f4SGreg Roach * 42323788f4SGreg Roach * @return bool 43323788f4SGreg Roach */ 448f53f488SRico Sonntag public function hasMarriedNames(): bool 45c1010edaSGreg Roach { 46323788f4SGreg Roach return false; 47323788f4SGreg Roach } 48323788f4SGreg Roach 49323788f4SGreg Roach /** 50c1ec7145SGreg Roach * Does this surname tradition use surnames? 51c1ec7145SGreg Roach * 52c1ec7145SGreg Roach * @return bool 53c1ec7145SGreg Roach */ 548f53f488SRico Sonntag public function hasSurnames(): bool 55c1010edaSGreg Roach { 56c1ec7145SGreg Roach return true; 57c1ec7145SGreg Roach } 58c1ec7145SGreg Roach 59c1ec7145SGreg Roach /** 60323788f4SGreg Roach * What names are given to a new child 61323788f4SGreg Roach * 62323788f4SGreg Roach * @param string $father_name A GEDCOM NAME 63323788f4SGreg Roach * @param string $mother_name A GEDCOM NAME 64323788f4SGreg Roach * @param string $child_sex M, F or U 65323788f4SGreg Roach * 66323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 67323788f4SGreg Roach */ 68771ae10aSGreg Roach public function newChildNames(string $father_name, string $mother_name, string $child_sex): array 69c1010edaSGreg Roach { 7013abd6f3SGreg Roach return [ 71323788f4SGreg Roach 'NAME' => '//', 7213abd6f3SGreg Roach ]; 73323788f4SGreg Roach } 74323788f4SGreg Roach 75323788f4SGreg Roach /** 76323788f4SGreg Roach * What names are given to a new parent 77323788f4SGreg Roach * 78323788f4SGreg Roach * @param string $child_name A GEDCOM NAME 79323788f4SGreg Roach * @param string $parent_sex M, F or U 80323788f4SGreg Roach * 81323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 82323788f4SGreg Roach */ 83771ae10aSGreg Roach public function newParentNames(string $child_name, string $parent_sex): array 84c1010edaSGreg Roach { 8513abd6f3SGreg Roach return [ 86323788f4SGreg Roach 'NAME' => '//', 8713abd6f3SGreg Roach ]; 88323788f4SGreg Roach } 89323788f4SGreg Roach 90323788f4SGreg Roach /** 91323788f4SGreg Roach * What names are given to a new spouse 92323788f4SGreg Roach * 93323788f4SGreg Roach * @param string $spouse_name A GEDCOM NAME 94323788f4SGreg Roach * @param string $spouse_sex M, F or U 95323788f4SGreg Roach * 96323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 97323788f4SGreg Roach */ 98771ae10aSGreg Roach public function newSpouseNames(string $spouse_name, string $spouse_sex): array 99c1010edaSGreg Roach { 10013abd6f3SGreg Roach return [ 101323788f4SGreg Roach 'NAME' => '//', 10213abd6f3SGreg Roach ]; 103323788f4SGreg Roach } 104323788f4SGreg Roach} 105