1323788f4SGreg Roach<?php 2323788f4SGreg Roach/** 3323788f4SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 webtrees development team 5323788f4SGreg Roach * This program is free software: you can redistribute it and/or modify 6323788f4SGreg Roach * it under the terms of the GNU General Public License as published by 7323788f4SGreg Roach * the Free Software Foundation, either version 3 of the License, or 8323788f4SGreg Roach * (at your option) any later version. 9323788f4SGreg Roach * This program is distributed in the hope that it will be useful, 10323788f4SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 11323788f4SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12323788f4SGreg Roach * GNU General Public License for more details. 13323788f4SGreg Roach * You should have received a copy of the GNU General Public License 14323788f4SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 15323788f4SGreg Roach */ 16323788f4SGreg Roachnamespace Fisharebest\Webtrees\SurnameTradition; 17323788f4SGreg Roach 18323788f4SGreg Roach/** 19323788f4SGreg Roach * All family members keep their original surname 20323788f4SGreg Roach */ 21c1010edaSGreg Roachclass DefaultSurnameTradition implements SurnameTraditionInterface 22c1010edaSGreg Roach{ 23323788f4SGreg Roach /** Extract a GIVN from a NAME */ 24323788f4SGreg Roach const REGEX_GIVN = '~^(?<GIVN>[^/ ]+)~'; 25323788f4SGreg Roach 26323788f4SGreg Roach /** Extract a SPFX and SURN from a NAME */ 279797fe2eSGreg Roach const REGEX_SPFX_SURN = '~(?<NAME>/(?<SPFX>[a-z’\']{0,4}(?: [a-z’\']{1,4})*) ?(?<SURN>[^/]*)/)~'; 28323788f4SGreg Roach 29323788f4SGreg Roach /** Extract a simple SURN from a NAME */ 30323788f4SGreg Roach const REGEX_SURN = '~(?<NAME>/(?<SURN>[^/]+)/)~'; 31323788f4SGreg Roach 32323788f4SGreg Roach /** Extract two Spanish/Portuguese SURNs from a NAME */ 33323788f4SGreg Roach const REGEX_SURNS = '~/(?<SURN1>[^ /]+)(?: | y |/ /|/ y /)(?<SURN2>[^ /]+)/~'; 34323788f4SGreg Roach 35323788f4SGreg Roach /** 36323788f4SGreg Roach * Does this surname tradition change surname at marriage? 37323788f4SGreg Roach * 38323788f4SGreg Roach * @return bool 39323788f4SGreg Roach */ 40c1010edaSGreg Roach public function hasMarriedNames() 41c1010edaSGreg Roach { 42323788f4SGreg Roach return false; 43323788f4SGreg Roach } 44323788f4SGreg Roach 45323788f4SGreg Roach /** 46c1ec7145SGreg Roach * Does this surname tradition use surnames? 47c1ec7145SGreg Roach * 48c1ec7145SGreg Roach * @return bool 49c1ec7145SGreg Roach */ 50c1010edaSGreg Roach public function hasSurnames() 51c1010edaSGreg Roach { 52c1ec7145SGreg Roach return true; 53c1ec7145SGreg Roach } 54c1ec7145SGreg Roach 55c1ec7145SGreg Roach /** 56323788f4SGreg Roach * What names are given to a new child 57323788f4SGreg Roach * 58323788f4SGreg Roach * @param string $father_name A GEDCOM NAME 59323788f4SGreg Roach * @param string $mother_name A GEDCOM NAME 60323788f4SGreg Roach * @param string $child_sex M, F or U 61323788f4SGreg Roach * 62323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 63323788f4SGreg Roach */ 64*771ae10aSGreg Roach public function newChildNames(string $father_name, string $mother_name, string $child_sex): array 65c1010edaSGreg Roach { 6613abd6f3SGreg Roach return [ 67323788f4SGreg Roach 'NAME' => '//', 6813abd6f3SGreg Roach ]; 69323788f4SGreg Roach } 70323788f4SGreg Roach 71323788f4SGreg Roach /** 72323788f4SGreg Roach * What names are given to a new parent 73323788f4SGreg Roach * 74323788f4SGreg Roach * @param string $child_name A GEDCOM NAME 75323788f4SGreg Roach * @param string $parent_sex M, F or U 76323788f4SGreg Roach * 77323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 78323788f4SGreg Roach */ 79*771ae10aSGreg Roach public function newParentNames(string $child_name, string $parent_sex): array 80c1010edaSGreg Roach { 8113abd6f3SGreg Roach return [ 82323788f4SGreg Roach 'NAME' => '//', 8313abd6f3SGreg Roach ]; 84323788f4SGreg Roach } 85323788f4SGreg Roach 86323788f4SGreg Roach /** 87323788f4SGreg Roach * What names are given to a new spouse 88323788f4SGreg Roach * 89323788f4SGreg Roach * @param string $spouse_name A GEDCOM NAME 90323788f4SGreg Roach * @param string $spouse_sex M, F or U 91323788f4SGreg Roach * 92323788f4SGreg Roach * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) 93323788f4SGreg Roach */ 94*771ae10aSGreg Roach public function newSpouseNames(string $spouse_name, string $spouse_sex): array 95c1010edaSGreg Roach { 9613abd6f3SGreg Roach return [ 97323788f4SGreg Roach 'NAME' => '//', 9813abd6f3SGreg Roach ]; 99323788f4SGreg Roach } 100323788f4SGreg Roach} 101