public function UcAddressesSchemaAddress::compareAddress in Ubercart Addresses 7
Same name and namespace in other branches
- 6.2 class/UcAddressesSchemaAddress.class.php \UcAddressesSchemaAddress::compareAddress()
Checks if the schema address of the given address is equal to the schema address of this.
@access public
Parameters
UcAddressesSchemaAddress $address: The address to compare against.
Return value
boolean TRUE if the addresses are considered equal. FALSE otherwise.
File
- class/
UcAddressesSchemaAddress.class.php, line 529 - Contains the UcAddressesSchemaAddress class.
Class
- UcAddressesSchemaAddress
- The schema address class.
Code
public function compareAddress(UcAddressesSchemaAddress $address) {
$fields_to_compare =& drupal_static('UcAddressesSchemaAddress::compareAddress', array());
if ($address === $this) {
// No comparison needed. Given address object is exactly the same.
return TRUE;
}
$fieldsDataThisAddress = $this
->getRawFieldData();
$fieldsDataOtherAddress = $address
->getRawFieldData();
// Find out which field to compare.
if (count($fields_to_compare) < 1) {
$fields_data = self::getDefinedFields();
foreach ($fields_data as $fieldName => $field_data) {
if ($field_data['compare']) {
$fields_to_compare[] = $fieldName;
}
}
}
foreach ($fields_to_compare as $fieldName) {
if ($fieldsDataThisAddress[$fieldName] != $fieldsDataOtherAddress[$fieldName]) {
return FALSE;
}
}
return TRUE;
}