/** * Returns the full address * * @return string */ function getFullAddress(ContactAddress $address) { if ($address) { $line1 = $address->getStreet(); $line2 = ''; if ($address->getCity() != '') { $line2 = $address->getCity(); } if ($address->getState() != '') { if ($line2 != '') { $line2 .= ', '; } $line2 .= $address->getState(); } if ($address->getZipcode() != '') { if ($line2 != '') { $line2 .= ', '; } $line2 .= $address->getZipcode(); } $line3 = ''; if ($address->getCountryName() != '') { $line3 = $address->getCountryName(); } $result = $line1; if ($line2 != '') { $result .= "\n" . $line2; } if ($line3 != '') { $result .= "\n" . $line3; } return $result; } return ""; }