private static void ValidateAreaCode(string rawPhoneNumber, string phoneNumberDigits) { if (phoneNumberDigits[AreaCodeDigitIndex] == '0' || phoneNumberDigits[TrunkPrefixDigitIndex] != '0') { throw InvalidPhoneNumberException.InvalidAreaCode(rawPhoneNumber); } }
private static void ValidateNumberOfDigits(string rawPhoneNumber, string phoneNumberDigits) { if (phoneNumberDigits.Length != InternationalPhoneNumberLength && phoneNumberDigits.Length != LocalPhoneNumberLength) { throw InvalidPhoneNumberException.InvalidNumberOfDigits(rawPhoneNumber); } }
private static void ValidateFormat(string rawPhoneNumber, string phoneNumberDigits) { if (!IsLocalFormattedPhoneNumber(phoneNumberDigits)) { throw InvalidPhoneNumberException.InvalidFormat(rawPhoneNumber); } }