public static function UcAddress::makeCanonical in Ubercart 7.3
Utility function to simplify comparison of address properties.
For the purpose of this function, the canonical form is stripped of all whitespace and has been converted to upper case. This ensures that we don't get false inequalities when comparing address properties that a human would consider identical, but may be capitalized differently or have different whitespace.
Parameters
$string: String to make canonical.
Return value
Canonical form of input string.
1 call to UcAddress::makeCanonical()
- UcAddress::isSamePhysicalLocation in uc_store/
classes/ address.inc - Compares two UcAddress objects to determine if they represent the same physical address.
File
- uc_store/
classes/ address.inc, line 104 - UcAddress utility class definition.
Class
- UcAddress
- Defines an object to hold Ubercart mailing address information.
Code
public static function makeCanonical($string = '') {
// Remove all whitespace.
$string = preg_replace('/\\s+/', '', $string);
// Make all characters upper case.
$string = drupal_strtoupper($string);
return $string;
}