Interface Equivalence
A strategy for determining whether two values are considered equivalent.
It is important to distinguish between a type that can be compared for
equality and a representation of an equivalence relation. This interface is
for representing the latter, while PhpCommon\Comparison\Equatable
is for representing the
former.
For the purpose of this interface, an equivalence relation is a binary relation that is reflexive, symmetric, transitive and consistent. Additionally, an equivalence relation can be either generic or type-specific. The "equals" relation is an example of a generic relation. Type-specific examples include:
- "Has the same birthday as" on the set of all people.
- "Is similar to" or "congruent to" on the set of all triangles.
- "Has the same absolute value" on the set of real numbers.
Consult the documentation of the specific PhpCommon\Comparison\Equivalence
implementation
for more information about the supported types.
It is inspired by the Equivalence
interface, from Guava API.
- PhpCommon\Comparison\Equivalence implements PhpCommon\Comparison\Equatable
Direct known implementers
PhpCommon\Comparison\Equivalence\GenericEquivalence, PhpCommon\Comparison\HasherIndirect known implementers
PhpCommon\Comparison\Hasher\DateTimeHasher, PhpCommon\Comparison\Hasher\GenericHasher, PhpCommon\Comparison\Hasher\IdentityHasher, PhpCommon\Comparison\Hasher\ValueHasherAuthor: Marcos Passos marcos@marcospassos.com
Link: Guava Equivalent interface
Located at Equivalence.php
public
boolean
|
#
equivalent( mixed $left, mixed $right )
Checks whether the specified values are considered equivalent. |
equals()
|