Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorPilley authored Nov 8, 2024
1 parent a46a151 commit 8489389
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ protected override string ProvideFormat(PhoneNumber phoneNumber, bool internatio
var ndcOptional = phoneNumber.NdcIsOptional();

// The base formats cover all UK formats except for 6 digit subscriber numbers as in the UK they aren't separated.
return phoneNumber.SubscriberNumber.Length switch
if (phoneNumber.SubscriberNumber.Length == 6 &&
phoneNumber.NationalDestinationCode!.Length == 4)
{
6 => phoneNumber.NationalDestinationCode!.Length switch
{
#pragma warning disable S3358 // Extract this nested ternary operation into an independent statement.
4 => international ? "#### ######" : ndcOptional ? "(0####) ######" : "0#### ######",
return international ? "#### ######" : ndcOptional ? "(0####) ######" : "0#### ######";
#pragma warning restore S3358 // Extract this nested ternary operation into an independent statement.
_ => base.ProvideFormat(phoneNumber, international),
},
_ => base.ProvideFormat(phoneNumber, international),
};
}

return base.ProvideFormat(phoneNumber, international);
}
}

0 comments on commit 8489389

Please sign in to comment.