Пример #1
0
 /**
  * This will check to see if this person has a near-match on the first and last name provided.
  * It will check first name against nicknames, it will check last name against prior last names
  * @param string $strFirstName
  * @param string $strLastName
  * @return boolean whether or not there was a match
  */
 public function IsNameMatch($strFirstName, $strLastName)
 {
     $strFirstName = NameItem::NormalizeNameItem($strFirstName);
     $strLastName = NameItem::NormalizeNameItem($strLastName);
     // Check First Name
     if ($strFirstName != NameItem::NormalizeNameItem($this->FirstName)) {
         // If we are here, then we should try and match against the nickname
         $blnFound = false;
         foreach (explode(',', $this->Nickname) as $strName) {
             if (strlen(trim($strName)) && $strFirstName == NameItem::NormalizeNameItem($strName)) {
                 $blnFound = true;
             }
         }
         if (!$blnFound) {
             return false;
         }
     }
     // So far, so good!  If we are here, then the first name is valid
     // Now, let's check the last name
     if ($strLastName != NameItem::NormalizeNameItem($this->LastName)) {
         // If we are here, then we should try and match against the nickname
         $blnFound = false;
         foreach (explode(',', $this->PriorLastNames) as $strName) {
             if (strlen(trim($strName)) && $strLastName == NameItem::NormalizeNameItem($strName)) {
                 $blnFound = true;
             }
         }
         if (!$blnFound) {
             return false;
         }
     }
     // If we are here, then we've succeeded!
     return true;
 }