You are here

public function AddressTrait::isSamePhysicalLocation in Ubercart 8.4

File

uc_store/src/AddressTrait.php, line 285

Class

AddressTrait
Defines a trait implementing \Drupal\uc_store\AddressInterface.

Namespace

Drupal\uc_store

Code

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

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