Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Fix 'dtfm' vs 'dtmf' typo #61

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions client/src/main/com/sinch/sdk/models/DualToneMultiFrequency.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ public class DualToneMultiFrequency {
private static final Logger LOGGER = Logger.getLogger(DualToneMultiFrequency.class.getName());
private static final Pattern PATTERN = Pattern.compile("([0-9#w])*");
private static final AtomicBoolean STRICT = new AtomicBoolean(true);
private final String dtfm;
private final String dtmf;

/**
* Create an instance of DualToneMultiFrequency
*
* @param dtfm The dtfm value. Valid characters in the string are "0"-"9", "#" and "w"
* @param dtmf The dtmf value. Valid characters in the string are "0"-"9", "#" and "w"
* @throws IllegalArgumentException Throw an exception if value contains invalid characters
*/
public DualToneMultiFrequency(String dtfm) throws IllegalArgumentException {
public DualToneMultiFrequency(String dtmf) throws IllegalArgumentException {

if (!validate(dtfm)) {
String message = String.format("Invalid DTFM format for '%s' number", dtfm);
if (!validate(dtmf)) {
String message = String.format("Invalid DTMF format: '%s'", dtmf);

if (STRICT.get()) {
throw new IllegalArgumentException(message);
}
LOGGER.warning(message);
}
this.dtfm = dtfm;
this.dtmf = dtmf;
}

/**
Expand All @@ -62,7 +62,7 @@ public static void setStrict(boolean strict) {
}

/**
* Validate string against authorized values for DTFM value
* Validate string against authorized values for DTMF value
*
* @param value The value to be validated
* @return Is string valid or not
Expand All @@ -72,17 +72,17 @@ public static boolean validate(String value) {
}

/**
* Get the DTFM value
* Get the DTMF value
*
* @return The dtfm value
* @return The dtmf value
*/
public String stringValue() {
return dtfm;
return dtmf;
}

@Override
public String toString() {
return "DualToneMultiFrequency{" + "dtfm='" + dtfm + '\'' + '}';
return "DualToneMultiFrequency{" + "dtmf='" + dtmf + '\'' + '}';
}

@Override
Expand All @@ -94,11 +94,11 @@ public boolean equals(Object o) {
return false;
}
DualToneMultiFrequency that = (DualToneMultiFrequency) o;
return Objects.equals(dtfm, that.dtfm);
return Objects.equals(dtmf, that.dtmf);
}

@Override
public int hashCode() {
return Objects.hash(dtfm);
return Objects.hash(dtmf);
}
}
Loading