public static function updateSubdivision($oldValue)
    {
        // Countries that have defined subdivisions.
        $supportedCountries = [
            'AD', 'AE', 'AM', 'AR', 'AU', 'BR', 'BS', 'CA', 'CL', 'CN', 'CV',
            'EG', 'ES', 'HK', 'ID', 'IE', 'IN', 'IT', 'JM', 'JP', 'KN', 'KR',
            'KY', 'MX', 'MY', 'NG', 'NI', 'NR', 'PH', 'RU', 'SO', 'SR', 'SV',
            'TH', 'TR', 'TV', 'TW', 'UA', 'US', 'UY', 'VE', 'VN'
        ];
        // Countries where the subdivision IDs just need the prefix removed.
        $simpleAdministrativeAreas = [
            'AU', 'BR', 'CA', 'IT', 'US',
        ];

        if (substr($oldValue, 2, 1) != '-') {
            // This is a full value, not the ID of a predefined value.
            return $oldValue;
        }
        $countryCode = substr($oldValue, 0, 2);
        if (!in_array($countryCode, $supportedCountries)) {
            // Unrecognized country code.
            return $oldValue;
        }

        // Prefixed administrative area.
        $parts = explode('-', $oldValue);
        $isAdministrativeArea = count($parts) == 2;
        if ($isAdministrativeArea && in_array($countryCode, $simpleAdministrativeAreas)) {
            return $parts[1];
        }
        // Mapped value.
        $updateMap = static::loadSubdivisionUpdateMap();
        if (isset($updateMap[$oldValue])) {
            return $updateMap[$oldValue];
        }

        return $oldValue;
    }
public static function updateSubdivision($oldValue)
    {
        // Countries that have defined subdivisions.
        $supportedCountries = [
            'AD', 'AE', 'AM', 'AR', 'AU', 'BR', 'BS', 'CA', 'CL', 'CN', 'CV',
            'EG', 'ES', 'HK', 'ID', 'IE', 'IN', 'IT', 'JM', 'JP', 'KN', 'KR',
            'KY', 'MX', 'MY', 'NG', 'NI', 'NR', 'PH', 'RU', 'SO', 'SR', 'SV',
            'TH', 'TR', 'TV', 'TW', 'UA', 'US', 'UY', 'VE', 'VN'
        ];
        // Countries where the subdivision IDs just need the prefix removed.
        $simpleAdministrativeAreas = [
            'AU', 'BR', 'CA', 'IT', 'US',
        ];

        if (substr($oldValue, 2, 1) != '-') {
            // This is a full value, not the ID of a predefined value.
            return $oldValue;
        }
        $countryCode = substr($oldValue, 0, 2);
        if (!in_array($countryCode, $supportedCountries)) {
            // Unrecognized country code.
            return $oldValue;
        }

        // Prefixed administrative area.
        $parts = explode('-', $oldValue);
        $isAdministrativeArea = count($parts) == 2;
        if ($isAdministrativeArea && in_array($countryCode, $simpleAdministrativeAreas)) {
            return $parts[1];
        }
        // Mapped value.
        $updateMap = static::loadSubdivisionUpdateMap();
        if (isset($updateMap[$oldValue])) {
            return $updateMap[$oldValue];
        }

        return $oldValue;
    }
public static function updateSubdivision ( $ oldValue ) { // Countries that have defined subdivisions. $ supportedCountries = [ 'AD' , 'AE' , 'AM' , 'AR' , 'AU' , 'BR' , 'BS' , 'CA' , 'CL' , 'CN' , 'CV' , 'EG' , 'ES' , 'HK' , 'ID' , 'IE' , 'IN' , 'IT' , 'JM' , 'JP' , 'KN' , 'KR' , 'KY' , 'MX' , 'MY' , 'NG' , 'NI' , 'NR' , 'PH' , 'RU' , 'SO' , 'SR' , 'SV' , 'TH' , 'TR' , 'TV' , 'TW' , 'UA' , 'US' , 'UY' , 'VE' , 'VN' ] ; // Countries where the subdivision IDs just need the prefix removed. $ simpleAdministrativeAreas = [ 'AU' , 'BR' , 'CA' , 'IT' , 'US' , ] ; if ( substr ( $ oldValue , 2 , 1 ) != '-' ) { // This is a full value, not the ID of a predefined value. return $ oldValue ; } $ countryCode = substr ( $ oldValue , 0 , 2 ) ; if ( ! in_array ( $ countryCode , $ supportedCountries ) ) { // Unrecognized country code. return $ oldValue ; } // Prefixed administrative area. $ parts = explode ( '-' , $ oldValue ) ; $ isAdministrativeArea = count ( $ parts ) == 2 ; if ( $ isAdministrativeArea && in_array ( $ countryCode , $ simpleAdministrativeAreas ) ) { return $ parts [ 1 ] ; } // Mapped value. $ updateMap = static :: loadSubdivisionUpdateMap ( ) ; if ( isset ( $ updateMap [ $ oldValue ] ) ) { return $ updateMap [ $ oldValue ] ; } return $ oldValue ; }
Updates the subdivision.

Used for updating the administrative area, locality, dependent locality
address properties.

@param string $oldValue The old value.

@return string The new value.
Updates the subdivision .