@@ -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' => '//', |
@@ -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'], |
@@ -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' => '//', |
@@ -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 | ); |
@@ -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 | } |
@@ -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 | } |
@@ -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 | * |
@@ -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 | ); |
@@ -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 SpecialCharsIs extends AbstractSpecialChars { |
|
24 | +class SpecialCharsIs 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 | ); |