| 1 | <?php |
||
| 5 | class Lastname extends AbstractPart |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * @var array possible lastname prefixes |
||
| 9 | */ |
||
| 10 | protected static $prefixes = [ |
||
| 11 | 'vere' => 'vere', |
||
| 12 | 'von' => 'von', |
||
| 13 | 'van' => 'van', |
||
| 14 | 'de' => 'de', |
||
| 15 | 'der' => 'der', |
||
| 16 | 'del' => 'del', |
||
| 17 | 'della' => 'della', |
||
| 18 | 'di' => 'di', |
||
| 19 | 'da' => 'da', |
||
| 20 | 'pietro' => 'pietro', |
||
| 21 | 'vanden' => 'vanden', |
||
| 22 | 'du' => 'du', |
||
| 23 | 'st' => 'st.', |
||
| 24 | 'la' => 'la', |
||
| 25 | 'ter' => 'ter' |
||
| 26 | ]; |
||
| 27 | /** @var bool */ |
||
| 28 | private $applyPrefix = false; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * check if the given word is a lastname prefix |
||
| 32 | * |
||
| 33 | * @param string $word the word to check |
||
| 34 | * @return bool |
||
| 35 | */ |
||
| 36 | public static function isPrefix($word) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * get the prefix registry key for the given word |
||
| 43 | * |
||
| 44 | * @param string $word the word |
||
| 45 | * @return string the key |
||
| 46 | */ |
||
| 47 | protected static function getKey($word) |
||
| 51 | |||
| 52 | /** |
||
| 53 | * if this is a lastname prefix, look up normalized version from registry |
||
| 54 | * otherwise camelcase the lastname |
||
| 55 | * |
||
| 56 | * @return mixed |
||
| 57 | */ |
||
| 58 | public function normalize() |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param bool $applyPrefix |
||
| 71 | */ |
||
| 72 | public function setApplyPrefix(bool $applyPrefix) |
||
| 76 | } |
||
| 77 |