/**
  * Connection-independent method for merging tags into
  * outbound messages.
  * @param string $messageText
  * @param MoodletxtRecipient $recipient Message recipient
  * @return string Tagged message for single recipient
  * @version 2014042201
  * @since 2011040801
  */
 public static final function mergeTagsIntoMessageText($messageText, MoodletxtRecipient $recipient)
 {
     // Swap in name binds
     $messageText = str_replace('%FIRSTNAME%', $recipient->getFirstName(), $messageText);
     $messageText = str_replace('%LASTNAME%', $recipient->getLastName(), $messageText);
     $messageText = str_replace('%FULLNAME%', $recipient->getFullName(), $messageText);
     return $messageText;
 }
 /**
  * Sets the associated source of the message, if known.
  * This is whatever Moodle User or addressbook contact sent in the message.
  * @param MoodletxtRecipient $associatedSource Known source for the message
  * @version 2012060101
  * @since 2012041701
  */
 public function setAssociatedSource(MoodletxtRecipient $associatedSource)
 {
     $this->associatedSource = $associatedSource;
     // Update persistent fields while we're at it
     $this->setSourceFirstName($associatedSource->getFirstName());
     $this->setSourceLastName($associatedSource->getLastName());
     if ($associatedSource->hasPhoneNumber()) {
         $this->setSourceNumber($associatedSource->getRecipientNumber());
     }
 }