Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
| NameValues | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
| getSalutations | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSuffixes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLastnamePrefixes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getNicknameDelimiters | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Pop PHP Framework (https://www.popphp.org/) |
| 4 | * |
| 5 | * @link https://github.com/popphp/popphp-framework |
| 6 | * @author Nick Sagona, III <dev@noladev.com> |
| 7 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 8 | * @license https://www.popphp.org/license New BSD License |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * @namespace |
| 13 | */ |
| 14 | namespace Pop\Parser\Name; |
| 15 | |
| 16 | /** |
| 17 | * Name values class |
| 18 | * |
| 19 | * @category Pop |
| 20 | * @package Pop\Parser |
| 21 | * @author Nick Sagona, III <dev@noladev.com> |
| 22 | * @copyright Copyright (c) 2009-2026 NOLA Interactive, LLC. |
| 23 | * @license https://www.popphp.org/license New BSD License |
| 24 | * @version 1.0.0 |
| 25 | */ |
| 26 | class NameValues |
| 27 | { |
| 28 | |
| 29 | /** |
| 30 | * A list of salutations |
| 31 | * @var array $salutations |
| 32 | * */ |
| 33 | protected static array $salutations = [ |
| 34 | 'mr' => 'Mr.', |
| 35 | 'mrs' => 'Mrs.', |
| 36 | 'ms' => 'Ms.', |
| 37 | 'mx' => 'Mx.', |
| 38 | 'miss' => 'Miss', |
| 39 | 'master' => 'Mr.', |
| 40 | 'mister' => 'Mr.', |
| 41 | 'dr' => 'Dr.', |
| 42 | 'prof' => 'Prof.', |
| 43 | 'rev' => 'Rev.', |
| 44 | 'fr' => 'Fr.', |
| 45 | 'sir' => 'Sir', |
| 46 | 'madam' => 'Madam', |
| 47 | 'his honour' => 'His Honour', |
| 48 | 'her honour' => 'Her Honour', |
| 49 | ]; |
| 50 | |
| 51 | /** |
| 52 | * A list of name suffixes |
| 53 | * @var array $suffixes |
| 54 | * */ |
| 55 | protected static array $suffixes = [ |
| 56 | 'jr' => 'Jr', |
| 57 | 'junior' => 'Junior', |
| 58 | 'sr' => 'Sr', |
| 59 | 'senior' => 'Senior', |
| 60 | 'i' => 'I', |
| 61 | 'ii' => 'II', |
| 62 | 'iii' => 'III', |
| 63 | 'iv' => 'IV', |
| 64 | 'v' => 'V', |
| 65 | 'phd' => 'PhD', |
| 66 | 'md' => 'MD', |
| 67 | 'esq' => 'Esq', |
| 68 | 'jd' => 'JD', |
| 69 | '1st' => '1st', |
| 70 | '2nd' => '2nd', |
| 71 | '3rd' => '3rd', |
| 72 | ]; |
| 73 | |
| 74 | /** |
| 75 | * A list of lastname prefixes |
| 76 | * @var array $lastnamePrefixes |
| 77 | * */ |
| 78 | protected static array $lastnamePrefixes = [ |
| 79 | 'van' => 'van', |
| 80 | 'von' => 'von', |
| 81 | 'de' => 'de', |
| 82 | 'del' => 'del', |
| 83 | 'della' => 'della', |
| 84 | 'der' => 'der', |
| 85 | 'di' => 'di', |
| 86 | 'da' => 'da', |
| 87 | 'du' => 'du', |
| 88 | 'la' => 'la', |
| 89 | 'le' => 'le', |
| 90 | 'st' => 'St.', |
| 91 | 'ter' => 'ter', |
| 92 | 'vanden' => 'vanden', |
| 93 | 'vere' => 'vere', |
| 94 | ]; |
| 95 | |
| 96 | /** |
| 97 | * A list of nickname-wrapping delimiter pairs (opening => closing) |
| 98 | * @var array $nicknameDelimiters |
| 99 | * */ |
| 100 | protected static array $nicknameDelimiters = [ |
| 101 | '(' => ')', |
| 102 | '[' => ']', |
| 103 | '{' => '}', |
| 104 | '<' => '>', |
| 105 | '"' => '"', |
| 106 | "'" => "'", |
| 107 | ]; |
| 108 | |
| 109 | /** |
| 110 | * Getter method for accessing the salutations list |
| 111 | * |
| 112 | * @return array |
| 113 | */ |
| 114 | public function getSalutations(): array |
| 115 | { |
| 116 | return self::$salutations; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Getter method for accessing the suffixes list |
| 121 | * |
| 122 | * @return array |
| 123 | */ |
| 124 | public function getSuffixes(): array |
| 125 | { |
| 126 | return self::$suffixes; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Getter method for accessing the lastname prefixes list |
| 131 | * |
| 132 | * @return array |
| 133 | */ |
| 134 | public function getLastnamePrefixes(): array |
| 135 | { |
| 136 | return self::$lastnamePrefixes; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Getter method for accessing the nickname delimiters list |
| 141 | * |
| 142 | * @return array |
| 143 | */ |
| 144 | public function getNicknameDelimiters(): array |
| 145 | { |
| 146 | return self::$nicknameDelimiters; |
| 147 | } |
| 148 | |
| 149 | } |