@@ -19,76 +19,76 @@ |
||
19 | 19 | * All family members keep their original surname |
20 | 20 | */ |
21 | 21 | class DefaultSurnameTradition implements SurnameTraditionInterface { |
22 | - /** Extract a GIVN from a NAME */ |
|
23 | - const REGEX_GIVN = '~^(?<GIVN>[^/ ]+)~'; |
|
22 | + /** Extract a GIVN from a NAME */ |
|
23 | + const REGEX_GIVN = '~^(?<GIVN>[^/ ]+)~'; |
|
24 | 24 | |
25 | - /** Extract a SPFX and SURN from a NAME */ |
|
26 | - const REGEX_SPFX_SURN = '~(?<NAME>/(?<SPFX>[a-z’\']{0,4}(?: [a-z’\']{1,4})*) ?(?<SURN>[^/]*)/)~'; |
|
25 | + /** Extract a SPFX and SURN from a NAME */ |
|
26 | + const REGEX_SPFX_SURN = '~(?<NAME>/(?<SPFX>[a-z’\']{0,4}(?: [a-z’\']{1,4})*) ?(?<SURN>[^/]*)/)~'; |
|
27 | 27 | |
28 | - /** Extract a simple SURN from a NAME */ |
|
29 | - const REGEX_SURN = '~(?<NAME>/(?<SURN>[^/]+)/)~'; |
|
28 | + /** Extract a simple SURN from a NAME */ |
|
29 | + const REGEX_SURN = '~(?<NAME>/(?<SURN>[^/]+)/)~'; |
|
30 | 30 | |
31 | - /** Extract two Spanish/Portuguese SURNs from a NAME */ |
|
32 | - const REGEX_SURNS = '~/(?<SURN1>[^ /]+)(?: | y |/ /|/ y /)(?<SURN2>[^ /]+)/~'; |
|
31 | + /** Extract two Spanish/Portuguese SURNs from a NAME */ |
|
32 | + const REGEX_SURNS = '~/(?<SURN1>[^ /]+)(?: | y |/ /|/ y /)(?<SURN2>[^ /]+)/~'; |
|
33 | 33 | |
34 | - /** |
|
35 | - * Does this surname tradition change surname at marriage? |
|
36 | - * |
|
37 | - * @return bool |
|
38 | - */ |
|
39 | - public function hasMarriedNames() { |
|
40 | - return false; |
|
41 | - } |
|
34 | + /** |
|
35 | + * Does this surname tradition change surname at marriage? |
|
36 | + * |
|
37 | + * @return bool |
|
38 | + */ |
|
39 | + public function hasMarriedNames() { |
|
40 | + return false; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Does this surname tradition use surnames? |
|
45 | - * |
|
46 | - * @return bool |
|
47 | - */ |
|
48 | - public function hasSurnames() { |
|
49 | - return true; |
|
50 | - } |
|
43 | + /** |
|
44 | + * Does this surname tradition use surnames? |
|
45 | + * |
|
46 | + * @return bool |
|
47 | + */ |
|
48 | + public function hasSurnames() { |
|
49 | + return true; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * What names are given to a new child |
|
54 | - * |
|
55 | - * @param string $father_name A GEDCOM NAME |
|
56 | - * @param string $mother_name A GEDCOM NAME |
|
57 | - * @param string $child_sex M, F or U |
|
58 | - * |
|
59 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
60 | - */ |
|
61 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
62 | - return array( |
|
63 | - 'NAME' => '//', |
|
64 | - ); |
|
65 | - } |
|
52 | + /** |
|
53 | + * What names are given to a new child |
|
54 | + * |
|
55 | + * @param string $father_name A GEDCOM NAME |
|
56 | + * @param string $mother_name A GEDCOM NAME |
|
57 | + * @param string $child_sex M, F or U |
|
58 | + * |
|
59 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
60 | + */ |
|
61 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
62 | + return array( |
|
63 | + 'NAME' => '//', |
|
64 | + ); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * What names are given to a new parent |
|
69 | - * |
|
70 | - * @param string $child_name A GEDCOM NAME |
|
71 | - * @param string $parent_sex M, F or U |
|
72 | - * |
|
73 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
74 | - */ |
|
75 | - public function newParentNames($child_name, $parent_sex) { |
|
76 | - return array( |
|
77 | - 'NAME' => '//', |
|
78 | - ); |
|
79 | - } |
|
67 | + /** |
|
68 | + * What names are given to a new parent |
|
69 | + * |
|
70 | + * @param string $child_name A GEDCOM NAME |
|
71 | + * @param string $parent_sex M, F or U |
|
72 | + * |
|
73 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
74 | + */ |
|
75 | + public function newParentNames($child_name, $parent_sex) { |
|
76 | + return array( |
|
77 | + 'NAME' => '//', |
|
78 | + ); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * What names are given to a new spouse |
|
83 | - * |
|
84 | - * @param string $spouse_name A GEDCOM NAME |
|
85 | - * @param string $spouse_sex M, F or U |
|
86 | - * |
|
87 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
88 | - */ |
|
89 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
90 | - return array( |
|
91 | - 'NAME' => '//', |
|
92 | - ); |
|
93 | - } |
|
81 | + /** |
|
82 | + * What names are given to a new spouse |
|
83 | + * |
|
84 | + * @param string $spouse_name A GEDCOM NAME |
|
85 | + * @param string $spouse_sex M, F or U |
|
86 | + * |
|
87 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
88 | + */ |
|
89 | + public function newSpouseNames($spouse_name, $spouse_sex) { |
|
90 | + return array( |
|
91 | + 'NAME' => '//', |
|
92 | + ); |
|
93 | + } |
|
94 | 94 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * All family members keep their original surname |
20 | 20 | */ |
21 | -class DefaultSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class DefaultSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** Extract a GIVN from a NAME */ |
23 | 24 | const REGEX_GIVN = '~^(?<GIVN>[^/ ]+)~'; |
24 | 25 | |
@@ -36,7 +37,8 @@ discard block |
||
36 | 37 | * |
37 | 38 | * @return bool |
38 | 39 | */ |
39 | - public function hasMarriedNames() { |
|
40 | + public function hasMarriedNames() |
|
41 | + { |
|
40 | 42 | return false; |
41 | 43 | } |
42 | 44 | |
@@ -45,7 +47,8 @@ discard block |
||
45 | 47 | * |
46 | 48 | * @return bool |
47 | 49 | */ |
48 | - public function hasSurnames() { |
|
50 | + public function hasSurnames() |
|
51 | + { |
|
49 | 52 | return true; |
50 | 53 | } |
51 | 54 | |
@@ -58,7 +61,8 @@ discard block |
||
58 | 61 | * |
59 | 62 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
60 | 63 | */ |
61 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
64 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
65 | + { |
|
62 | 66 | return array( |
63 | 67 | 'NAME' => '//', |
64 | 68 | ); |
@@ -72,7 +76,8 @@ discard block |
||
72 | 76 | * |
73 | 77 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
74 | 78 | */ |
75 | - public function newParentNames($child_name, $parent_sex) { |
|
79 | + public function newParentNames($child_name, $parent_sex) |
|
80 | + { |
|
76 | 81 | return array( |
77 | 82 | 'NAME' => '//', |
78 | 83 | ); |
@@ -86,7 +91,8 @@ discard block |
||
86 | 91 | * |
87 | 92 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
88 | 93 | */ |
89 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
94 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
95 | + { |
|
90 | 96 | return array( |
91 | 97 | 'NAME' => '//', |
92 | 98 | ); |
@@ -19,100 +19,100 @@ |
||
19 | 19 | * Lithuanian — Children take their father’s surname. Wives take their husband’s surname. Surnames are inflected to indicate an individual’s sex and marital status. |
20 | 20 | */ |
21 | 21 | class LithuanianSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface { |
22 | - /** @var string[] Inflect a surname for wives */ |
|
23 | - protected $inflect_wife = array( |
|
24 | - 'as\b' => 'ienė', |
|
25 | - 'is\b' => 'ienė', |
|
26 | - 'ys\b' => 'ienė', |
|
27 | - 'us\b' => 'ienė', |
|
28 | - ); |
|
22 | + /** @var string[] Inflect a surname for wives */ |
|
23 | + protected $inflect_wife = array( |
|
24 | + 'as\b' => 'ienė', |
|
25 | + 'is\b' => 'ienė', |
|
26 | + 'ys\b' => 'ienė', |
|
27 | + 'us\b' => 'ienė', |
|
28 | + ); |
|
29 | 29 | |
30 | - /** @var string[] Inflect a surname for daughters */ |
|
31 | - protected $inflect_daughter = array( |
|
32 | - 'a\b' => 'aitė', |
|
33 | - 'as\b' => 'aitė', |
|
34 | - 'is\b' => 'ytė', |
|
35 | - 'ys\b' => 'ytė', |
|
36 | - 'ius\b' => 'iūtė', |
|
37 | - 'us\b' => 'utė', |
|
38 | - ); |
|
30 | + /** @var string[] Inflect a surname for daughters */ |
|
31 | + protected $inflect_daughter = array( |
|
32 | + 'a\b' => 'aitė', |
|
33 | + 'as\b' => 'aitė', |
|
34 | + 'is\b' => 'ytė', |
|
35 | + 'ys\b' => 'ytė', |
|
36 | + 'ius\b' => 'iūtė', |
|
37 | + 'us\b' => 'utė', |
|
38 | + ); |
|
39 | 39 | |
40 | - /** @var string[] Inflect a surname for males */ |
|
41 | - protected $inflect_male = array( |
|
42 | - 'aitė\b' => 'as', |
|
43 | - 'ytė\b' => 'is', |
|
44 | - 'iūtė\b' => 'ius', |
|
45 | - 'utė\b' => 'us', |
|
46 | - ); |
|
40 | + /** @var string[] Inflect a surname for males */ |
|
41 | + protected $inflect_male = array( |
|
42 | + 'aitė\b' => 'as', |
|
43 | + 'ytė\b' => 'is', |
|
44 | + 'iūtė\b' => 'ius', |
|
45 | + 'utė\b' => 'us', |
|
46 | + ); |
|
47 | 47 | |
48 | - /** |
|
49 | - * What names are given to a new child |
|
50 | - * |
|
51 | - * @param string $father_name A GEDCOM NAME |
|
52 | - * @param string $mother_name A GEDCOM NAME |
|
53 | - * @param string $child_sex M, F or U |
|
54 | - * |
|
55 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
56 | - */ |
|
57 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
58 | - if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
|
59 | - if ($child_sex === 'F') { |
|
60 | - return array_filter(array( |
|
61 | - 'NAME' => $this->inflect($match['NAME'], $this->inflect_daughter), |
|
62 | - 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
63 | - )); |
|
64 | - } else { |
|
65 | - return array_filter(array( |
|
66 | - 'NAME' => $match['NAME'], |
|
67 | - 'SURN' => $match['SURN'], |
|
68 | - )); |
|
69 | - } |
|
70 | - } else { |
|
71 | - return array( |
|
72 | - 'NAME' => '//', |
|
73 | - ); |
|
74 | - } |
|
75 | - } |
|
48 | + /** |
|
49 | + * What names are given to a new child |
|
50 | + * |
|
51 | + * @param string $father_name A GEDCOM NAME |
|
52 | + * @param string $mother_name A GEDCOM NAME |
|
53 | + * @param string $child_sex M, F or U |
|
54 | + * |
|
55 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
56 | + */ |
|
57 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
58 | + if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
|
59 | + if ($child_sex === 'F') { |
|
60 | + return array_filter(array( |
|
61 | + 'NAME' => $this->inflect($match['NAME'], $this->inflect_daughter), |
|
62 | + 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
63 | + )); |
|
64 | + } else { |
|
65 | + return array_filter(array( |
|
66 | + 'NAME' => $match['NAME'], |
|
67 | + 'SURN' => $match['SURN'], |
|
68 | + )); |
|
69 | + } |
|
70 | + } else { |
|
71 | + return array( |
|
72 | + 'NAME' => '//', |
|
73 | + ); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * What names are given to a new parent |
|
79 | - * |
|
80 | - * @param string $child_name A GEDCOM NAME |
|
81 | - * @param string $parent_sex M, F or U |
|
82 | - * |
|
83 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
84 | - */ |
|
85 | - public function newParentNames($child_name, $parent_sex) { |
|
86 | - if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
|
87 | - return array_filter(array( |
|
88 | - 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
89 | - 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
90 | - )); |
|
91 | - } else { |
|
92 | - return array( |
|
93 | - 'NAME' => '//', |
|
94 | - ); |
|
95 | - } |
|
96 | - } |
|
77 | + /** |
|
78 | + * What names are given to a new parent |
|
79 | + * |
|
80 | + * @param string $child_name A GEDCOM NAME |
|
81 | + * @param string $parent_sex M, F or U |
|
82 | + * |
|
83 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
84 | + */ |
|
85 | + public function newParentNames($child_name, $parent_sex) { |
|
86 | + if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
|
87 | + return array_filter(array( |
|
88 | + 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
89 | + 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
90 | + )); |
|
91 | + } else { |
|
92 | + return array( |
|
93 | + 'NAME' => '//', |
|
94 | + ); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * What names are given to a new spouse |
|
100 | - * |
|
101 | - * @param string $spouse_name A GEDCOM NAME |
|
102 | - * @param string $spouse_sex M, F or U |
|
103 | - * |
|
104 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
105 | - */ |
|
106 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
107 | - if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
|
108 | - return array( |
|
109 | - 'NAME' => '//', |
|
110 | - '_MARNM' => $this->inflect($match['NAME'], $this->inflect_wife), |
|
111 | - ); |
|
112 | - } else { |
|
113 | - return array( |
|
114 | - 'NAME' => '//', |
|
115 | - ); |
|
116 | - } |
|
117 | - } |
|
98 | + /** |
|
99 | + * What names are given to a new spouse |
|
100 | + * |
|
101 | + * @param string $spouse_name A GEDCOM NAME |
|
102 | + * @param string $spouse_sex M, F or U |
|
103 | + * |
|
104 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
105 | + */ |
|
106 | + public function newSpouseNames($spouse_name, $spouse_sex) { |
|
107 | + if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
|
108 | + return array( |
|
109 | + 'NAME' => '//', |
|
110 | + '_MARNM' => $this->inflect($match['NAME'], $this->inflect_wife), |
|
111 | + ); |
|
112 | + } else { |
|
113 | + return array( |
|
114 | + 'NAME' => '//', |
|
115 | + ); |
|
116 | + } |
|
117 | + } |
|
118 | 118 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Lithuanian — Children take their father’s surname. Wives take their husband’s surname. Surnames are inflected to indicate an individual’s sex and marital status. |
20 | 20 | */ |
21 | -class LithuanianSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class LithuanianSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** @var string[] Inflect a surname for wives */ |
23 | 24 | protected $inflect_wife = array( |
24 | 25 | 'as\b' => 'ienė', |
@@ -54,7 +55,8 @@ discard block |
||
54 | 55 | * |
55 | 56 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
56 | 57 | */ |
57 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
58 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
59 | + { |
|
58 | 60 | if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
59 | 61 | if ($child_sex === 'F') { |
60 | 62 | return array_filter(array( |
@@ -82,7 +84,8 @@ discard block |
||
82 | 84 | * |
83 | 85 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
84 | 86 | */ |
85 | - public function newParentNames($child_name, $parent_sex) { |
|
87 | + public function newParentNames($child_name, $parent_sex) |
|
88 | + { |
|
86 | 89 | if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
87 | 90 | return array_filter(array( |
88 | 91 | 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
@@ -103,7 +106,8 @@ discard block |
||
103 | 106 | * |
104 | 107 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
105 | 108 | */ |
106 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
109 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
110 | + { |
|
107 | 111 | if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
108 | 112 | return array( |
109 | 113 | 'NAME' => '//', |
@@ -19,48 +19,48 @@ |
||
19 | 19 | * Children take their mother’s surname. |
20 | 20 | */ |
21 | 21 | class MatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
22 | - /** |
|
23 | - * What names are given to a new child |
|
24 | - * |
|
25 | - * @param string $father_name A GEDCOM NAME |
|
26 | - * @param string $mother_name A GEDCOM NAME |
|
27 | - * @param string $child_sex M, F or U |
|
28 | - * |
|
29 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
30 | - */ |
|
31 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | - if (preg_match(self::REGEX_SPFX_SURN, $mother_name, $match)) { |
|
33 | - return array_filter(array( |
|
34 | - 'NAME' => $match['NAME'], |
|
35 | - 'SPFX' => $match['SPFX'], |
|
36 | - 'SURN' => $match['SURN'], |
|
37 | - )); |
|
38 | - } else { |
|
39 | - return array( |
|
40 | - 'NAME' => '//', |
|
41 | - ); |
|
42 | - } |
|
43 | - } |
|
22 | + /** |
|
23 | + * What names are given to a new child |
|
24 | + * |
|
25 | + * @param string $father_name A GEDCOM NAME |
|
26 | + * @param string $mother_name A GEDCOM NAME |
|
27 | + * @param string $child_sex M, F or U |
|
28 | + * |
|
29 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
30 | + */ |
|
31 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | + if (preg_match(self::REGEX_SPFX_SURN, $mother_name, $match)) { |
|
33 | + return array_filter(array( |
|
34 | + 'NAME' => $match['NAME'], |
|
35 | + 'SPFX' => $match['SPFX'], |
|
36 | + 'SURN' => $match['SURN'], |
|
37 | + )); |
|
38 | + } else { |
|
39 | + return array( |
|
40 | + 'NAME' => '//', |
|
41 | + ); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * What names are given to a new parent |
|
47 | - * |
|
48 | - * @param string $child_name A GEDCOM NAME |
|
49 | - * @param string $parent_sex M, F or U |
|
50 | - * |
|
51 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
52 | - */ |
|
53 | - public function newParentNames($child_name, $parent_sex) { |
|
54 | - if ($parent_sex === 'F' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
|
55 | - return array_filter(array( |
|
56 | - 'NAME' => $match['NAME'], |
|
57 | - 'SPFX' => $match['SPFX'], |
|
58 | - 'SURN' => $match['SURN'], |
|
59 | - )); |
|
60 | - } else { |
|
61 | - return array( |
|
62 | - 'NAME' => '//', |
|
63 | - ); |
|
64 | - } |
|
65 | - } |
|
45 | + /** |
|
46 | + * What names are given to a new parent |
|
47 | + * |
|
48 | + * @param string $child_name A GEDCOM NAME |
|
49 | + * @param string $parent_sex M, F or U |
|
50 | + * |
|
51 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
52 | + */ |
|
53 | + public function newParentNames($child_name, $parent_sex) { |
|
54 | + if ($parent_sex === 'F' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
|
55 | + return array_filter(array( |
|
56 | + 'NAME' => $match['NAME'], |
|
57 | + 'SPFX' => $match['SPFX'], |
|
58 | + 'SURN' => $match['SURN'], |
|
59 | + )); |
|
60 | + } else { |
|
61 | + return array( |
|
62 | + 'NAME' => '//', |
|
63 | + ); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Children take their mother’s surname. |
20 | 20 | */ |
21 | -class MatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class MatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * What names are given to a new child |
24 | 25 | * |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * |
29 | 30 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
30 | 31 | */ |
31 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
33 | + { |
|
32 | 34 | if (preg_match(self::REGEX_SPFX_SURN, $mother_name, $match)) { |
33 | 35 | return array_filter(array( |
34 | 36 | 'NAME' => $match['NAME'], |
@@ -50,7 +52,8 @@ discard block |
||
50 | 52 | * |
51 | 53 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
52 | 54 | */ |
53 | - public function newParentNames($child_name, $parent_sex) { |
|
55 | + public function newParentNames($child_name, $parent_sex) |
|
56 | + { |
|
54 | 57 | if ($parent_sex === 'F' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
55 | 58 | return array_filter(array( |
56 | 59 | 'NAME' => $match['NAME'], |
@@ -19,90 +19,90 @@ |
||
19 | 19 | * Children take their father’s surname. Wives take their husband’s surname. Surnames are inflected to indicate an individual’s sex. |
20 | 20 | */ |
21 | 21 | class PolishSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface { |
22 | - /** @var string[] Inflect a surname for females */ |
|
23 | - protected $inflect_female = array( |
|
24 | - 'cki\b' => 'cka', |
|
25 | - 'dzki\b' => 'dzka', |
|
26 | - 'ski\b' => 'ska', |
|
27 | - 'żki\b' => 'żka', |
|
28 | - ); |
|
22 | + /** @var string[] Inflect a surname for females */ |
|
23 | + protected $inflect_female = array( |
|
24 | + 'cki\b' => 'cka', |
|
25 | + 'dzki\b' => 'dzka', |
|
26 | + 'ski\b' => 'ska', |
|
27 | + 'żki\b' => 'żka', |
|
28 | + ); |
|
29 | 29 | |
30 | - /** @var string[] Inflect a surname for males */ |
|
31 | - protected $inflect_male = array( |
|
32 | - 'cka\b' => 'cki', |
|
33 | - 'dzka\b' => 'dzki', |
|
34 | - 'ska\b' => 'ski', |
|
35 | - 'żka\b' => 'żki', |
|
36 | - ); |
|
30 | + /** @var string[] Inflect a surname for males */ |
|
31 | + protected $inflect_male = array( |
|
32 | + 'cka\b' => 'cki', |
|
33 | + 'dzka\b' => 'dzki', |
|
34 | + 'ska\b' => 'ski', |
|
35 | + 'żka\b' => 'żki', |
|
36 | + ); |
|
37 | 37 | |
38 | - /** |
|
39 | - * What names are given to a new child |
|
40 | - * |
|
41 | - * @param string $father_name A GEDCOM NAME |
|
42 | - * @param string $mother_name A GEDCOM NAME |
|
43 | - * @param string $child_sex M, F or U |
|
44 | - * |
|
45 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
46 | - */ |
|
47 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
48 | - if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
|
49 | - if ($child_sex === 'F') { |
|
50 | - return array_filter(array( |
|
51 | - 'NAME' => $this->inflect($match['NAME'], $this->inflect_female), |
|
52 | - 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
53 | - )); |
|
54 | - } else { |
|
55 | - return array_filter(array( |
|
56 | - 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
57 | - 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
58 | - )); |
|
59 | - } |
|
60 | - } else { |
|
61 | - return array( |
|
62 | - 'NAME' => '//', |
|
63 | - ); |
|
64 | - } |
|
65 | - } |
|
38 | + /** |
|
39 | + * What names are given to a new child |
|
40 | + * |
|
41 | + * @param string $father_name A GEDCOM NAME |
|
42 | + * @param string $mother_name A GEDCOM NAME |
|
43 | + * @param string $child_sex M, F or U |
|
44 | + * |
|
45 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
46 | + */ |
|
47 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
48 | + if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
|
49 | + if ($child_sex === 'F') { |
|
50 | + return array_filter(array( |
|
51 | + 'NAME' => $this->inflect($match['NAME'], $this->inflect_female), |
|
52 | + 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
53 | + )); |
|
54 | + } else { |
|
55 | + return array_filter(array( |
|
56 | + 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
57 | + 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
58 | + )); |
|
59 | + } |
|
60 | + } else { |
|
61 | + return array( |
|
62 | + 'NAME' => '//', |
|
63 | + ); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * What names are given to a new parent |
|
69 | - * |
|
70 | - * @param string $child_name A GEDCOM NAME |
|
71 | - * @param string $parent_sex M, F or U |
|
72 | - * |
|
73 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
74 | - */ |
|
75 | - public function newParentNames($child_name, $parent_sex) { |
|
76 | - if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
|
77 | - return array_filter(array( |
|
78 | - 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
79 | - 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
80 | - )); |
|
81 | - } else { |
|
82 | - return array( |
|
83 | - 'NAME' => '//', |
|
84 | - ); |
|
85 | - } |
|
86 | - } |
|
67 | + /** |
|
68 | + * What names are given to a new parent |
|
69 | + * |
|
70 | + * @param string $child_name A GEDCOM NAME |
|
71 | + * @param string $parent_sex M, F or U |
|
72 | + * |
|
73 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
74 | + */ |
|
75 | + public function newParentNames($child_name, $parent_sex) { |
|
76 | + if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
|
77 | + return array_filter(array( |
|
78 | + 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
|
79 | + 'SURN' => $this->inflect($match['SURN'], $this->inflect_male), |
|
80 | + )); |
|
81 | + } else { |
|
82 | + return array( |
|
83 | + 'NAME' => '//', |
|
84 | + ); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * What names are given to a new spouse |
|
90 | - * |
|
91 | - * @param string $spouse_name A GEDCOM NAME |
|
92 | - * @param string $spouse_sex M, F or U |
|
93 | - * |
|
94 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
95 | - */ |
|
96 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
97 | - if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
|
98 | - return array( |
|
99 | - 'NAME' => '//', |
|
100 | - '_MARNM' => $this->inflect($match['NAME'], $this->inflect_female), |
|
101 | - ); |
|
102 | - } else { |
|
103 | - return array( |
|
104 | - 'NAME' => '//', |
|
105 | - ); |
|
106 | - } |
|
107 | - } |
|
88 | + /** |
|
89 | + * What names are given to a new spouse |
|
90 | + * |
|
91 | + * @param string $spouse_name A GEDCOM NAME |
|
92 | + * @param string $spouse_sex M, F or U |
|
93 | + * |
|
94 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
95 | + */ |
|
96 | + public function newSpouseNames($spouse_name, $spouse_sex) { |
|
97 | + if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
|
98 | + return array( |
|
99 | + 'NAME' => '//', |
|
100 | + '_MARNM' => $this->inflect($match['NAME'], $this->inflect_female), |
|
101 | + ); |
|
102 | + } else { |
|
103 | + return array( |
|
104 | + 'NAME' => '//', |
|
105 | + ); |
|
106 | + } |
|
107 | + } |
|
108 | 108 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Children take their father’s surname. Wives take their husband’s surname. Surnames are inflected to indicate an individual’s sex. |
20 | 20 | */ |
21 | -class PolishSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class PolishSurnameTradition extends PaternalSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** @var string[] Inflect a surname for females */ |
23 | 24 | protected $inflect_female = array( |
24 | 25 | 'cki\b' => 'cka', |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | * |
45 | 46 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
46 | 47 | */ |
47 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
48 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
49 | + { |
|
48 | 50 | if (preg_match(self::REGEX_SURN, $father_name, $match)) { |
49 | 51 | if ($child_sex === 'F') { |
50 | 52 | return array_filter(array( |
@@ -72,7 +74,8 @@ discard block |
||
72 | 74 | * |
73 | 75 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
74 | 76 | */ |
75 | - public function newParentNames($child_name, $parent_sex) { |
|
77 | + public function newParentNames($child_name, $parent_sex) |
|
78 | + { |
|
76 | 79 | if ($parent_sex === 'M' && preg_match(self::REGEX_SURN, $child_name, $match)) { |
77 | 80 | return array_filter(array( |
78 | 81 | 'NAME' => $this->inflect($match['NAME'], $this->inflect_male), |
@@ -93,7 +96,8 @@ discard block |
||
93 | 96 | * |
94 | 97 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
95 | 98 | */ |
96 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
99 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
100 | + { |
|
97 | 101 | if ($spouse_sex === 'F' && preg_match(self::REGEX_SURN, $spouse_name, $match)) { |
98 | 102 | return array( |
99 | 103 | 'NAME' => '//', |
@@ -23,74 +23,74 @@ |
||
23 | 23 | * Child: Pablo /DDDD/ /BBBB/ |
24 | 24 | */ |
25 | 25 | class PortugueseSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
26 | - /** |
|
27 | - * What names are given to a new child |
|
28 | - * |
|
29 | - * @param string $father_name A GEDCOM NAME |
|
30 | - * @param string $mother_name A GEDCOM NAME |
|
31 | - * @param string $child_sex M, F or U |
|
32 | - * |
|
33 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
34 | - */ |
|
35 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
36 | - if (preg_match(self::REGEX_SURNS, $father_name, $match_father)) { |
|
37 | - $father_surname = $match_father['SURN2']; |
|
38 | - } else { |
|
39 | - $father_surname = ''; |
|
40 | - } |
|
26 | + /** |
|
27 | + * What names are given to a new child |
|
28 | + * |
|
29 | + * @param string $father_name A GEDCOM NAME |
|
30 | + * @param string $mother_name A GEDCOM NAME |
|
31 | + * @param string $child_sex M, F or U |
|
32 | + * |
|
33 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
34 | + */ |
|
35 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
36 | + if (preg_match(self::REGEX_SURNS, $father_name, $match_father)) { |
|
37 | + $father_surname = $match_father['SURN2']; |
|
38 | + } else { |
|
39 | + $father_surname = ''; |
|
40 | + } |
|
41 | 41 | |
42 | - if (preg_match(self::REGEX_SURNS, $mother_name, $match_mother)) { |
|
43 | - $mother_surname = $match_mother['SURN2']; |
|
44 | - } else { |
|
45 | - $mother_surname = ''; |
|
46 | - } |
|
42 | + if (preg_match(self::REGEX_SURNS, $mother_name, $match_mother)) { |
|
43 | + $mother_surname = $match_mother['SURN2']; |
|
44 | + } else { |
|
45 | + $mother_surname = ''; |
|
46 | + } |
|
47 | 47 | |
48 | - return array( |
|
49 | - 'NAME' => '/' . $father_surname . '/ /' . $mother_surname . '/', |
|
50 | - 'SURN' => trim($father_surname . ',' . $mother_surname, ','), |
|
51 | - ); |
|
52 | - } |
|
48 | + return array( |
|
49 | + 'NAME' => '/' . $father_surname . '/ /' . $mother_surname . '/', |
|
50 | + 'SURN' => trim($father_surname . ',' . $mother_surname, ','), |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * What names are given to a new parent |
|
56 | - * |
|
57 | - * @param string $child_name A GEDCOM NAME |
|
58 | - * @param string $parent_sex M, F or U |
|
59 | - * |
|
60 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
61 | - */ |
|
62 | - public function newParentNames($child_name, $parent_sex) { |
|
63 | - if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
|
64 | - switch ($parent_sex) { |
|
65 | - case 'M': |
|
66 | - return array( |
|
67 | - 'NAME' => '// /' . $match['SURN1'] . '/', |
|
68 | - 'SURN' => $match['SURN1'], |
|
69 | - ); |
|
70 | - case 'F': |
|
71 | - return array( |
|
72 | - 'NAME' => '// /' . $match['SURN2'] . '/', |
|
73 | - 'SURN' => $match['SURN2'], |
|
74 | - ); |
|
75 | - } |
|
76 | - } |
|
54 | + /** |
|
55 | + * What names are given to a new parent |
|
56 | + * |
|
57 | + * @param string $child_name A GEDCOM NAME |
|
58 | + * @param string $parent_sex M, F or U |
|
59 | + * |
|
60 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
61 | + */ |
|
62 | + public function newParentNames($child_name, $parent_sex) { |
|
63 | + if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
|
64 | + switch ($parent_sex) { |
|
65 | + case 'M': |
|
66 | + return array( |
|
67 | + 'NAME' => '// /' . $match['SURN1'] . '/', |
|
68 | + 'SURN' => $match['SURN1'], |
|
69 | + ); |
|
70 | + case 'F': |
|
71 | + return array( |
|
72 | + 'NAME' => '// /' . $match['SURN2'] . '/', |
|
73 | + 'SURN' => $match['SURN2'], |
|
74 | + ); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return array( |
|
79 | - 'NAME' => '// //', |
|
80 | - ); |
|
81 | - } |
|
78 | + return array( |
|
79 | + 'NAME' => '// //', |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * What names are given to a new spouse |
|
85 | - * |
|
86 | - * @param string $spouse_name A GEDCOM NAME |
|
87 | - * @param string $spouse_sex M, F or U |
|
88 | - * |
|
89 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
90 | - */ |
|
91 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
92 | - return array( |
|
93 | - 'NAME' => '// //', |
|
94 | - ); |
|
95 | - } |
|
83 | + /** |
|
84 | + * What names are given to a new spouse |
|
85 | + * |
|
86 | + * @param string $spouse_name A GEDCOM NAME |
|
87 | + * @param string $spouse_sex M, F or U |
|
88 | + * |
|
89 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
90 | + */ |
|
91 | + public function newSpouseNames($spouse_name, $spouse_sex) { |
|
92 | + return array( |
|
93 | + 'NAME' => '// //', |
|
94 | + ); |
|
95 | + } |
|
96 | 96 | } |
@@ -62,16 +62,16 @@ |
||
62 | 62 | public function newParentNames($child_name, $parent_sex) { |
63 | 63 | if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
64 | 64 | switch ($parent_sex) { |
65 | - case 'M': |
|
66 | - return array( |
|
67 | - 'NAME' => '// /' . $match['SURN1'] . '/', |
|
68 | - 'SURN' => $match['SURN1'], |
|
69 | - ); |
|
70 | - case 'F': |
|
71 | - return array( |
|
72 | - 'NAME' => '// /' . $match['SURN2'] . '/', |
|
73 | - 'SURN' => $match['SURN2'], |
|
74 | - ); |
|
65 | + case 'M': |
|
66 | + return array( |
|
67 | + 'NAME' => '// /' . $match['SURN1'] . '/', |
|
68 | + 'SURN' => $match['SURN1'], |
|
69 | + ); |
|
70 | + case 'F': |
|
71 | + return array( |
|
72 | + 'NAME' => '// /' . $match['SURN2'] . '/', |
|
73 | + 'SURN' => $match['SURN2'], |
|
74 | + ); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | * Father: Jose /CCCC/ /DDDD/ |
23 | 23 | * Child: Pablo /DDDD/ /BBBB/ |
24 | 24 | */ |
25 | -class PortugueseSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
|
25 | +class PortugueseSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface |
|
26 | +{ |
|
26 | 27 | /** |
27 | 28 | * What names are given to a new child |
28 | 29 | * |
@@ -32,7 +33,8 @@ discard block |
||
32 | 33 | * |
33 | 34 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
34 | 35 | */ |
35 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
36 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
37 | + { |
|
36 | 38 | if (preg_match(self::REGEX_SURNS, $father_name, $match_father)) { |
37 | 39 | $father_surname = $match_father['SURN2']; |
38 | 40 | } else { |
@@ -59,7 +61,8 @@ discard block |
||
59 | 61 | * |
60 | 62 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
61 | 63 | */ |
62 | - public function newParentNames($child_name, $parent_sex) { |
|
64 | + public function newParentNames($child_name, $parent_sex) |
|
65 | + { |
|
63 | 66 | if (preg_match(self::REGEX_SURNS, $child_name, $match)) { |
64 | 67 | switch ($parent_sex) { |
65 | 68 | case 'M': |
@@ -88,7 +91,8 @@ discard block |
||
88 | 91 | * |
89 | 92 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
90 | 93 | */ |
91 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
94 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
95 | + { |
|
92 | 96 | return array( |
93 | 97 | 'NAME' => '// //', |
94 | 98 | ); |
@@ -22,69 +22,69 @@ |
||
22 | 22 | * Daughters get their father’s given name plus “sdottir” |
23 | 23 | */ |
24 | 24 | class IcelandicSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
25 | - /** |
|
26 | - * Does this surname tradition use surnames? |
|
27 | - * |
|
28 | - * @return bool |
|
29 | - */ |
|
30 | - public function hasSurnames() { |
|
31 | - return false; |
|
32 | - } |
|
25 | + /** |
|
26 | + * Does this surname tradition use surnames? |
|
27 | + * |
|
28 | + * @return bool |
|
29 | + */ |
|
30 | + public function hasSurnames() { |
|
31 | + return false; |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * What names are given to a new child |
|
36 | - * |
|
37 | - * @param string $father_name A GEDCOM NAME |
|
38 | - * @param string $mother_name A GEDCOM NAME |
|
39 | - * @param string $child_sex M, F or U |
|
40 | - * |
|
41 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
42 | - */ |
|
43 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
44 | - if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) { |
|
45 | - switch ($child_sex) { |
|
46 | - case 'M': |
|
47 | - return array( |
|
48 | - 'NAME' => $father_match['GIVN'] . 'sson', |
|
49 | - ); |
|
50 | - case 'F': |
|
51 | - return array( |
|
52 | - 'NAME' => $father_match['GIVN'] . 'sdottir', |
|
53 | - ); |
|
54 | - } |
|
55 | - } |
|
34 | + /** |
|
35 | + * What names are given to a new child |
|
36 | + * |
|
37 | + * @param string $father_name A GEDCOM NAME |
|
38 | + * @param string $mother_name A GEDCOM NAME |
|
39 | + * @param string $child_sex M, F or U |
|
40 | + * |
|
41 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
42 | + */ |
|
43 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
44 | + if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) { |
|
45 | + switch ($child_sex) { |
|
46 | + case 'M': |
|
47 | + return array( |
|
48 | + 'NAME' => $father_match['GIVN'] . 'sson', |
|
49 | + ); |
|
50 | + case 'F': |
|
51 | + return array( |
|
52 | + 'NAME' => $father_match['GIVN'] . 'sdottir', |
|
53 | + ); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - return array(); |
|
58 | - } |
|
57 | + return array(); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * What names are given to a new parent |
|
62 | - * |
|
63 | - * @param string $child_name A GEDCOM NAME |
|
64 | - * @param string $parent_sex M, F or U |
|
65 | - * |
|
66 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
67 | - */ |
|
68 | - public function newParentNames($child_name, $parent_sex) { |
|
69 | - if ($parent_sex === 'M' && preg_match('~(?<GIVN>[^ /]+)(:?sson|sdottir)$~', $child_name, $child_match)) { |
|
70 | - return array( |
|
71 | - 'NAME' => $child_match['GIVN'], |
|
72 | - 'GIVN' => $child_match['GIVN'], |
|
73 | - ); |
|
74 | - } else { |
|
75 | - return array(); |
|
76 | - } |
|
77 | - } |
|
60 | + /** |
|
61 | + * What names are given to a new parent |
|
62 | + * |
|
63 | + * @param string $child_name A GEDCOM NAME |
|
64 | + * @param string $parent_sex M, F or U |
|
65 | + * |
|
66 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
67 | + */ |
|
68 | + public function newParentNames($child_name, $parent_sex) { |
|
69 | + if ($parent_sex === 'M' && preg_match('~(?<GIVN>[^ /]+)(:?sson|sdottir)$~', $child_name, $child_match)) { |
|
70 | + return array( |
|
71 | + 'NAME' => $child_match['GIVN'], |
|
72 | + 'GIVN' => $child_match['GIVN'], |
|
73 | + ); |
|
74 | + } else { |
|
75 | + return array(); |
|
76 | + } |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * What names are given to a new spouse |
|
81 | - * |
|
82 | - * @param string $spouse_name A GEDCOM NAME |
|
83 | - * @param string $spouse_sex M, F or U |
|
84 | - * |
|
85 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
86 | - */ |
|
87 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
88 | - return array(); |
|
89 | - } |
|
79 | + /** |
|
80 | + * What names are given to a new spouse |
|
81 | + * |
|
82 | + * @param string $spouse_name A GEDCOM NAME |
|
83 | + * @param string $spouse_sex M, F or U |
|
84 | + * |
|
85 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
86 | + */ |
|
87 | + public function newSpouseNames($spouse_name, $spouse_sex) { |
|
88 | + return array(); |
|
89 | + } |
|
90 | 90 | } |
@@ -43,14 +43,14 @@ |
||
43 | 43 | public function newChildNames($father_name, $mother_name, $child_sex) { |
44 | 44 | if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) { |
45 | 45 | switch ($child_sex) { |
46 | - case 'M': |
|
47 | - return array( |
|
48 | - 'NAME' => $father_match['GIVN'] . 'sson', |
|
49 | - ); |
|
50 | - case 'F': |
|
51 | - return array( |
|
52 | - 'NAME' => $father_match['GIVN'] . 'sdottir', |
|
53 | - ); |
|
46 | + case 'M': |
|
47 | + return array( |
|
48 | + 'NAME' => $father_match['GIVN'] . 'sson', |
|
49 | + ); |
|
50 | + case 'F': |
|
51 | + return array( |
|
52 | + 'NAME' => $father_match['GIVN'] . 'sdottir', |
|
53 | + ); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 |
@@ -21,13 +21,15 @@ discard block |
||
21 | 21 | * Sons get their father’s given name plus “sson” |
22 | 22 | * Daughters get their father’s given name plus “sdottir” |
23 | 23 | */ |
24 | -class IcelandicSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
|
24 | +class IcelandicSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface |
|
25 | +{ |
|
25 | 26 | /** |
26 | 27 | * Does this surname tradition use surnames? |
27 | 28 | * |
28 | 29 | * @return bool |
29 | 30 | */ |
30 | - public function hasSurnames() { |
|
31 | + public function hasSurnames() |
|
32 | + { |
|
31 | 33 | return false; |
32 | 34 | } |
33 | 35 | |
@@ -40,7 +42,8 @@ discard block |
||
40 | 42 | * |
41 | 43 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
42 | 44 | */ |
43 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
45 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
46 | + { |
|
44 | 47 | if (preg_match(self::REGEX_GIVN, $father_name, $father_match)) { |
45 | 48 | switch ($child_sex) { |
46 | 49 | case 'M': |
@@ -65,7 +68,8 @@ discard block |
||
65 | 68 | * |
66 | 69 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
67 | 70 | */ |
68 | - public function newParentNames($child_name, $parent_sex) { |
|
71 | + public function newParentNames($child_name, $parent_sex) |
|
72 | + { |
|
69 | 73 | if ($parent_sex === 'M' && preg_match('~(?<GIVN>[^ /]+)(:?sson|sdottir)$~', $child_name, $child_match)) { |
70 | 74 | return array( |
71 | 75 | 'NAME' => $child_match['GIVN'], |
@@ -84,7 +88,8 @@ discard block |
||
84 | 88 | * |
85 | 89 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
86 | 90 | */ |
87 | - public function newSpouseNames($spouse_name, $spouse_sex) { |
|
91 | + public function newSpouseNames($spouse_name, $spouse_sex) |
|
92 | + { |
|
88 | 93 | return array(); |
89 | 94 | } |
90 | 95 | } |
@@ -19,62 +19,62 @@ |
||
19 | 19 | * Children take their father’s surname. |
20 | 20 | */ |
21 | 21 | class PatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
22 | - /** |
|
23 | - * What names are given to a new child |
|
24 | - * |
|
25 | - * @param string $father_name A GEDCOM NAME |
|
26 | - * @param string $mother_name A GEDCOM NAME |
|
27 | - * @param string $child_sex M, F or U |
|
28 | - * |
|
29 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
30 | - */ |
|
31 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | - if (preg_match(self::REGEX_SPFX_SURN, $father_name, $match)) { |
|
33 | - return array_filter(array( |
|
34 | - 'NAME' => $match['NAME'], |
|
35 | - 'SPFX' => $match['SPFX'], |
|
36 | - 'SURN' => $match['SURN'], |
|
37 | - )); |
|
38 | - } else { |
|
39 | - return array( |
|
40 | - 'NAME' => '//', |
|
41 | - ); |
|
42 | - } |
|
43 | - } |
|
22 | + /** |
|
23 | + * What names are given to a new child |
|
24 | + * |
|
25 | + * @param string $father_name A GEDCOM NAME |
|
26 | + * @param string $mother_name A GEDCOM NAME |
|
27 | + * @param string $child_sex M, F or U |
|
28 | + * |
|
29 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
30 | + */ |
|
31 | + public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | + if (preg_match(self::REGEX_SPFX_SURN, $father_name, $match)) { |
|
33 | + return array_filter(array( |
|
34 | + 'NAME' => $match['NAME'], |
|
35 | + 'SPFX' => $match['SPFX'], |
|
36 | + 'SURN' => $match['SURN'], |
|
37 | + )); |
|
38 | + } else { |
|
39 | + return array( |
|
40 | + 'NAME' => '//', |
|
41 | + ); |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * What names are given to a new parent |
|
47 | - * |
|
48 | - * @param string $child_name A GEDCOM NAME |
|
49 | - * @param string $parent_sex M, F or U |
|
50 | - * |
|
51 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
52 | - */ |
|
53 | - public function newParentNames($child_name, $parent_sex) { |
|
54 | - if ($parent_sex === 'M' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
|
55 | - return array_filter(array( |
|
56 | - 'NAME' => $match['NAME'], |
|
57 | - 'SPFX' => $match['SPFX'], |
|
58 | - 'SURN' => $match['SURN'], |
|
59 | - )); |
|
60 | - } else { |
|
61 | - return array( |
|
62 | - 'NAME' => '//', |
|
63 | - ); |
|
64 | - } |
|
65 | - } |
|
45 | + /** |
|
46 | + * What names are given to a new parent |
|
47 | + * |
|
48 | + * @param string $child_name A GEDCOM NAME |
|
49 | + * @param string $parent_sex M, F or U |
|
50 | + * |
|
51 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
52 | + */ |
|
53 | + public function newParentNames($child_name, $parent_sex) { |
|
54 | + if ($parent_sex === 'M' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
|
55 | + return array_filter(array( |
|
56 | + 'NAME' => $match['NAME'], |
|
57 | + 'SPFX' => $match['SPFX'], |
|
58 | + 'SURN' => $match['SURN'], |
|
59 | + )); |
|
60 | + } else { |
|
61 | + return array( |
|
62 | + 'NAME' => '//', |
|
63 | + ); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * @param string $name A name |
|
69 | - * @param string[] $inflections A list of inflections |
|
70 | - * |
|
71 | - * @return string An inflected name |
|
72 | - */ |
|
73 | - protected function inflect($name, $inflections) { |
|
74 | - foreach ($inflections as $from => $to) { |
|
75 | - $name = preg_replace('~' . $from . '~u', $to, $name); |
|
76 | - } |
|
67 | + /** |
|
68 | + * @param string $name A name |
|
69 | + * @param string[] $inflections A list of inflections |
|
70 | + * |
|
71 | + * @return string An inflected name |
|
72 | + */ |
|
73 | + protected function inflect($name, $inflections) { |
|
74 | + foreach ($inflections as $from => $to) { |
|
75 | + $name = preg_replace('~' . $from . '~u', $to, $name); |
|
76 | + } |
|
77 | 77 | |
78 | - return $name; |
|
79 | - } |
|
78 | + return $name; |
|
79 | + } |
|
80 | 80 | } |
@@ -18,7 +18,8 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Children take their father’s surname. |
20 | 20 | */ |
21 | -class PatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface { |
|
21 | +class PatrilinealSurnameTradition extends DefaultSurnameTradition implements SurnameTraditionInterface |
|
22 | +{ |
|
22 | 23 | /** |
23 | 24 | * What names are given to a new child |
24 | 25 | * |
@@ -28,7 +29,8 @@ discard block |
||
28 | 29 | * |
29 | 30 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
30 | 31 | */ |
31 | - public function newChildNames($father_name, $mother_name, $child_sex) { |
|
32 | + public function newChildNames($father_name, $mother_name, $child_sex) |
|
33 | + { |
|
32 | 34 | if (preg_match(self::REGEX_SPFX_SURN, $father_name, $match)) { |
33 | 35 | return array_filter(array( |
34 | 36 | 'NAME' => $match['NAME'], |
@@ -50,7 +52,8 @@ discard block |
||
50 | 52 | * |
51 | 53 | * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
52 | 54 | */ |
53 | - public function newParentNames($child_name, $parent_sex) { |
|
55 | + public function newParentNames($child_name, $parent_sex) |
|
56 | + { |
|
54 | 57 | if ($parent_sex === 'M' && preg_match(self::REGEX_SPFX_SURN, $child_name, $match)) { |
55 | 58 | return array_filter(array( |
56 | 59 | 'NAME' => $match['NAME'], |
@@ -70,7 +73,8 @@ discard block |
||
70 | 73 | * |
71 | 74 | * @return string An inflected name |
72 | 75 | */ |
73 | - protected function inflect($name, $inflections) { |
|
76 | + protected function inflect($name, $inflections) |
|
77 | + { |
|
74 | 78 | foreach ($inflections as $from => $to) { |
75 | 79 | $name = preg_replace('~' . $from . '~u', $to, $name); |
76 | 80 | } |
@@ -20,48 +20,48 @@ |
||
20 | 20 | * By providing defaults for new individuals, we can speed up data entry and reduce errors. |
21 | 21 | */ |
22 | 22 | interface SurnameTraditionInterface { |
23 | - /** |
|
24 | - * Does this surname tradition change surname at marriage? |
|
25 | - * |
|
26 | - * @return bool |
|
27 | - */ |
|
28 | - public function hasMarriedNames(); |
|
23 | + /** |
|
24 | + * Does this surname tradition change surname at marriage? |
|
25 | + * |
|
26 | + * @return bool |
|
27 | + */ |
|
28 | + public function hasMarriedNames(); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Does this surname tradition use surnames? |
|
32 | - * |
|
33 | - * @return bool |
|
34 | - */ |
|
35 | - public function hasSurnames(); |
|
30 | + /** |
|
31 | + * Does this surname tradition use surnames? |
|
32 | + * |
|
33 | + * @return bool |
|
34 | + */ |
|
35 | + public function hasSurnames(); |
|
36 | 36 | |
37 | - /** |
|
38 | - * What names are given to a new child |
|
39 | - * |
|
40 | - * @param string $father_name A GEDCOM NAME |
|
41 | - * @param string $mother_name A GEDCOM NAME |
|
42 | - * @param string $child_sex M, F or U |
|
43 | - * |
|
44 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
45 | - */ |
|
46 | - public function newChildNames($father_name, $mother_name, $child_sex); |
|
37 | + /** |
|
38 | + * What names are given to a new child |
|
39 | + * |
|
40 | + * @param string $father_name A GEDCOM NAME |
|
41 | + * @param string $mother_name A GEDCOM NAME |
|
42 | + * @param string $child_sex M, F or U |
|
43 | + * |
|
44 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
45 | + */ |
|
46 | + public function newChildNames($father_name, $mother_name, $child_sex); |
|
47 | 47 | |
48 | - /** |
|
49 | - * What names are given to a new parent |
|
50 | - * |
|
51 | - * @param string $child_name A GEDCOM NAME |
|
52 | - * @param string $parent_sex M, F or U |
|
53 | - * |
|
54 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
55 | - */ |
|
56 | - public function newParentNames($child_name, $parent_sex); |
|
48 | + /** |
|
49 | + * What names are given to a new parent |
|
50 | + * |
|
51 | + * @param string $child_name A GEDCOM NAME |
|
52 | + * @param string $parent_sex M, F or U |
|
53 | + * |
|
54 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
55 | + */ |
|
56 | + public function newParentNames($child_name, $parent_sex); |
|
57 | 57 | |
58 | - /** |
|
59 | - * What names are given to a new spouse |
|
60 | - * |
|
61 | - * @param string $spouse_name A GEDCOM NAME |
|
62 | - * @param string $spouse_sex M, F or U |
|
63 | - * |
|
64 | - * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
65 | - */ |
|
66 | - public function newSpouseNames($spouse_name, $spouse_sex); |
|
58 | + /** |
|
59 | + * What names are given to a new spouse |
|
60 | + * |
|
61 | + * @param string $spouse_name A GEDCOM NAME |
|
62 | + * @param string $spouse_sex M, F or U |
|
63 | + * |
|
64 | + * @return string[] Associative array of GEDCOM name parts (SURN, _MARNM, etc.) |
|
65 | + */ |
|
66 | + public function newSpouseNames($spouse_name, $spouse_sex); |
|
67 | 67 | } |
@@ -19,7 +19,8 @@ |
||
19 | 19 | * Various cultures have different traditions for the use of surnames within families. |
20 | 20 | * By providing defaults for new individuals, we can speed up data entry and reduce errors. |
21 | 21 | */ |
22 | -interface SurnameTraditionInterface { |
|
22 | +interface SurnameTraditionInterface |
|
23 | +{ |
|
23 | 24 | /** |
24 | 25 | * Does this surname tradition change surname at marriage? |
25 | 26 | * |
@@ -22,25 +22,25 @@ |
||
22 | 22 | * that may be difficult to type. |
23 | 23 | */ |
24 | 24 | class SpecialCharsEu extends AbstractSpecialChars { |
25 | - /** |
|
26 | - * A list of magiscule letters. |
|
27 | - * |
|
28 | - * @return string[] |
|
29 | - */ |
|
30 | - public function upper() { |
|
31 | - return array( |
|
32 | - 'Ç', |
|
33 | - ); |
|
34 | - } |
|
25 | + /** |
|
26 | + * A list of magiscule letters. |
|
27 | + * |
|
28 | + * @return string[] |
|
29 | + */ |
|
30 | + public function upper() { |
|
31 | + return array( |
|
32 | + 'Ç', |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * A list of miniscule letters. |
|
38 | - * |
|
39 | - * @return string[] |
|
40 | - */ |
|
41 | - public function lower() { |
|
42 | - return array( |
|
43 | - 'ç', |
|
44 | - ); |
|
45 | - } |
|
36 | + /** |
|
37 | + * A list of miniscule letters. |
|
38 | + * |
|
39 | + * @return string[] |
|
40 | + */ |
|
41 | + public function lower() { |
|
42 | + return array( |
|
43 | + 'ç', |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | } |
@@ -21,13 +21,15 @@ discard block |
||
21 | 21 | * For each language, list the symbols, puncutation and letters with diacritics |
22 | 22 | * that may be difficult to type. |
23 | 23 | */ |
24 | -class SpecialCharsEu extends AbstractSpecialChars { |
|
24 | +class SpecialCharsEu extends AbstractSpecialChars |
|
25 | +{ |
|
25 | 26 | /** |
26 | 27 | * A list of magiscule letters. |
27 | 28 | * |
28 | 29 | * @return string[] |
29 | 30 | */ |
30 | - public function upper() { |
|
31 | + public function upper() |
|
32 | + { |
|
31 | 33 | return array( |
32 | 34 | 'Ç', |
33 | 35 | ); |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string[] |
40 | 42 | */ |
41 | - public function lower() { |
|
43 | + public function lower() |
|
44 | + { |
|
42 | 45 | return array( |
43 | 46 | 'ç', |
44 | 47 | ); |