1 | <?php |
||
9 | class LastnameMapper extends AbstractMapper |
||
10 | { |
||
11 | /** |
||
12 | * @var array options |
||
13 | */ |
||
14 | protected $options = [ |
||
15 | 'match_single' => false, |
||
16 | ]; |
||
17 | |||
18 | /** |
||
19 | * map lastnames in the parts array |
||
20 | * |
||
21 | * @param array $parts the name parts |
||
22 | * @return array the mapped parts |
||
23 | */ |
||
24 | public function map(array $parts) |
||
40 | |||
41 | /** |
||
42 | * @param array $parts |
||
43 | * @return array |
||
44 | */ |
||
45 | protected function mapReversedParts(array $parts): array |
||
72 | |||
73 | /** |
||
74 | * @param array $parts |
||
75 | * @param int $index |
||
76 | * @return bool |
||
77 | */ |
||
78 | protected function isFollowedByLastnamePart(array $parts, int $index): bool |
||
84 | |||
85 | /** |
||
86 | * Assuming that the part at the given index is matched as a prefix, |
||
87 | * determines if the prefix should be applied to the lastname. |
||
88 | * |
||
89 | * We only apply it to the lastname if we already have at least one |
||
90 | * lastname part and there are other parts left in |
||
91 | * the name (this effectively prioritises firstname over prefix matching). |
||
92 | * |
||
93 | * This expects the parts array and index to be in the original order. |
||
94 | * |
||
95 | * @param array $parts |
||
96 | * @param int $index |
||
97 | * @return bool |
||
98 | */ |
||
99 | protected function isApplicablePrefix(array $parts, int $index): bool |
||
107 | } |
||
108 |