| @@ 5-26 (lines=22) @@ | ||
| 2 | ||
| 3 | namespace TheIconic\NameParser\Part; |
|
| 4 | ||
| 5 | class Salutation extends AbstractPart |
|
| 6 | { |
|
| 7 | protected $normalized = ''; |
|
| 8 | ||
| 9 | public function __construct(string $value, string $normalized = null) |
|
| 10 | { |
|
| 11 | $this->normalized = $normalized ?? $value; |
|
| 12 | ||
| 13 | return parent::__construct($value); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * if this is a lastname prefix, look up normalized version from registry |
|
| 18 | * otherwise camelcase the lastname |
|
| 19 | * |
|
| 20 | * @return string |
|
| 21 | */ |
|
| 22 | public function normalize(): string |
|
| 23 | { |
|
| 24 | return $this->normalized; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||
| @@ 5-26 (lines=22) @@ | ||
| 2 | ||
| 3 | namespace TheIconic\NameParser\Part; |
|
| 4 | ||
| 5 | class Suffix extends AbstractPart |
|
| 6 | { |
|
| 7 | protected $normalized = ''; |
|
| 8 | ||
| 9 | public function __construct(string $value, string $normalized = null) |
|
| 10 | { |
|
| 11 | $this->normalized = $normalized ?? $value; |
|
| 12 | ||
| 13 | return parent::__construct($value); |
|
| 14 | } |
|
| 15 | ||
| 16 | /** |
|
| 17 | * if this is a lastname prefix, look up normalized version from registry |
|
| 18 | * otherwise camelcase the lastname |
|
| 19 | * |
|
| 20 | * @return string |
|
| 21 | */ |
|
| 22 | public function normalize(): string |
|
| 23 | { |
|
| 24 | return $this->normalized; |
|
| 25 | } |
|
| 26 | } |
|
| 27 | ||