Add function for assembling display names by given name and family name
This commit is contained in:
@ -69,6 +69,25 @@ final class NodaNameSplitter {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Assembles first name and given name into a common name as pronounced in the given language.
|
||||
*
|
||||
* @param string $givenName Given name of the actor.
|
||||
* @param string $familyName Family name of the actor.
|
||||
* @param string $toAdd Additional information to add to the name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function assembleNameParts(string $givenName, string $familyName, string $toAdd = ''):string {
|
||||
|
||||
if (in_array($this->_lang, self::LANGS_FAMILY_NAME_FIRST, true)) {
|
||||
return trim($familyName) . ' ' . trim($givenName) . $toAdd;
|
||||
}
|
||||
|
||||
return trim($givenName . ' ' . $familyName) . $toAdd;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
Reference in New Issue
Block a user