You are here

public function UcAddress::isSamePhysicalLocation in Ubercart 7.3

Compares two UcAddress objects to determine if they represent the same physical address.

Address properties such as first_name, phone, and email aren't considered in this comparison because they don't contain information about the physical location.

Parameters

$address: An object of type UcAddress.

Return value

TRUE if the two addresses are the same physical location, else FALSE.

File

uc_store/classes/address.inc, line 74
UcAddress utility class definition.

Class

UcAddress
Defines an object to hold Ubercart mailing address information.

Code

public function isSamePhysicalLocation(UcAddress $address) {
  $physicalProperty = array(
    'street1',
    'street2',
    'city',
    'zone',
    'country',
    'postal_code',
  );
  foreach ($physicalProperty as $property) {

    // Canonicalize properties before comparing.
    if (UcAddress::makeCanonical($this->{$property}) != UcAddress::makeCanonical($address->{$property})) {
      return FALSE;
    }
  }
  return TRUE;
}