Skip to content

Instantly share code, notes, and snippets.

@howtomakeaturn
Created February 4, 2016 04:57
Show Gist options
  • Save howtomakeaturn/8f5dab81f2d11eb7e006 to your computer and use it in GitHub Desktop.
Save howtomakeaturn/8f5dab81f2d11eb7e006 to your computer and use it in GitHub Desktop.
function recipientName()
{
if($this->getRecipientFirstName() == '' && $this->getRecipientLastName() == ''){
return '';
}
if($this->getRecipientFirstName() == '' ){
return $this->getRecipientLastName();
}
if($this->getRecipientLastName() == '' ){
return $this->getRecipientFirstName();
}
if (preg_match('/[^\\p{Common}\\p{Latin}]/u', $this->getRecipientLastName() . $this->getRecipientFirstName())){
return $this->getRecipientLastName() . $this->getRecipientFirstName();
}else{
return $this->getRecipientFirstName() . ', ' . $this->getRecipientLastName();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment