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

Develop/tidy #722

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 0 additions & 2 deletions src/PhoneNumbers/ParseException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Runtime.Serialization;

namespace PhoneNumbers;

/// <summary>
Expand Down
14 changes: 4 additions & 10 deletions src/PhoneNumbers/Parsers/PhoneNumberParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@ namespace PhoneNumbers.Parsers;
/// <summary>
/// The base class for a class which parses a string containing a phone number into a <see cref="PhoneNumber"/> instance.
/// </summary>
internal abstract class PhoneNumberParser
/// <param name="countryInfo">The <see cref="CountryInfo"/> of the country for the parser.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="countryInfo"/> is null.</exception>
internal abstract class PhoneNumberParser(CountryInfo countryInfo)
{
/// <summary>
/// Initialises a new instance of the <see cref="PhoneNumberParser"/> class.
/// </summary>
/// <param name="countryInfo">The <see cref="CountryInfo"/> of the country for the parser.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="countryInfo"/> is null.</exception>
protected PhoneNumberParser(CountryInfo countryInfo) =>
Country = countryInfo ?? throw new ArgumentNullException(nameof(countryInfo));

/// <summary>
/// Gets the <see cref="CountryInfo"/> for the parser.
/// </summary>
protected CountryInfo Country { get; }
protected CountryInfo Country { get; } = countryInfo ?? throw new ArgumentNullException(nameof(countryInfo));

/// <summary>
/// Parses the phone number represented in the specified string into a <see cref="PhoneNumber"/> instance.
Expand Down
12 changes: 3 additions & 9 deletions src/PhoneNumbers/PhoneNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ namespace PhoneNumbers;
/// <summary>
/// The base class representing a <see cref="PhoneNumber"/>.
/// </summary>
public abstract class PhoneNumber
/// <param name="phoneNumberHint">The <see cref="PhoneNumberHint"/> for the phone number.</param>
public abstract class PhoneNumber(PhoneNumberHint phoneNumberHint)
{
/// <summary>
/// Initialises a new instance of the <see cref="PhoneNumber"/> class.
/// </summary>
/// <param name="phoneNumberHint">The <see cref="PhoneNumberHint"/> for the phone number.</param>
protected PhoneNumber(PhoneNumberHint phoneNumberHint) =>
Hint = phoneNumberHint;

/// <summary>
/// Gets the <see cref="CountryInfo"/> for the phone number.
/// </summary>
Expand Down Expand Up @@ -52,7 +46,7 @@ protected PhoneNumber(PhoneNumberHint phoneNumberHint) =>
/// <summary>
/// Gets the <see cref="PhoneNumberHint"/>.
/// </summary>
protected PhoneNumberHint Hint { get; }
protected PhoneNumberHint Hint { get; } = phoneNumberHint;

/// <summary>
/// Parses the specified phone number value into a <see cref="PhoneNumber"/> instance based upon its calling code using the default <see cref="ParseOptions"/>.
Expand Down
Loading