Compares this Value Object with another for equality. Value Objects are equal if they are of the same type and all equality components match.
The other Value Object to compare with
true if the Value Objects are equal, false otherwise
StaticcreateCreates a PhoneNumber instance with validation. Accepts various formats and normalizes to E.164 format.
The phone number string (with or without formatting)
Success with PhoneNumber or Failure with DomainError
ProtectedgetReturns the components that determine equality for this Value Object. Two Value Objects are equal if all their equality components are equal.
An array of values used for equality comparison
Returns a string representation of an object.
Represents a phone number with international format support.
PhoneNumber is immutable and automatically normalizes the format. Supports E.164 format validation (international standard).
Example