Overview

Namespaces

  • PhpCommon
    • Comparison
      • Equivalence
      • Hasher

Classes

  • GenericEquivalence
  • Overview
  • Namespace
  • Class

Class GenericEquivalence

Base class for implementations of generic equivalence relations.

PhpCommon\Comparison\Equivalence\GenericEquivalence implements PhpCommon\Comparison\Equivalence

Direct known subclasses

PhpCommon\Comparison\Hasher\GenericHasher

Indirect known subclasses

PhpCommon\Comparison\Hasher\IdentityHasher, PhpCommon\Comparison\Hasher\ValueHasher
Abstract
Namespace: PhpCommon\Comparison\Equivalence
Author: Marcos Passos marcos@marcospassos.com
Located at Equivalence/GenericEquivalence.php
Methods summary
public boolean
# equivalent( mixed $left, mixed $right )

Checks whether the specified values are considered equivalent.

Checks whether the specified values are considered equivalent.

Parameters

$left
The left-hand value to compare.
$right
The right-hand value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Throws

UnexpectedTypeException

If the type of the left-hand side does not match the expected type.


IncomparableException

If the given values are not comparable under the specified equivalence relation.

Implementation of

PhpCommon\Comparison\Equivalence::equivalent()
abstract protected boolean
# equivalentArray( array $left, mixed $right )

Checks whether an array is equivalent to another value.

Checks whether an array is equivalent to another value.

Parameters

$left
The array to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP array
abstract protected boolean
# equivalentBoolean( boolean $left, mixed $right )

Checks whether a boolean value is equivalent to another value.

Checks whether a boolean value is equivalent to another value.

Parameters

$left
The boolean value to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP boolean
abstract protected boolean
# equivalentFloat( float $left, mixed $right )

Checks whether a floating-point number is equivalent to another value.

Checks whether a floating-point number is equivalent to another value.

Parameters

$left
The floating-point number to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP float
abstract protected boolean
# equivalentInteger( integer $left, mixed $right )

Checks whether an integer number is equivalent to another value.

Checks whether an integer number is equivalent to another value.

Parameters

$left
The integer number to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP integer
abstract protected boolean
# equivalentNull( mixed $right )

Checks whether value is equivalent to null.

Checks whether value is equivalent to null.

Parameters

$right
The value to compare.

Returns

boolean

Returns true if the given value is considered equivalent to null, false otherwise.

Link

PHP NULL
abstract protected boolean
# equivalentObject( object $left, mixed $right )

Checks whether an object is equivalent to another value.

Checks whether an object is equivalent to another value.

Parameters

$left
The object to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP object
abstract protected boolean
# equivalentResource( resource $left, mixed $right )

Checks whether a resource is equivalent to another value.

Checks whether a resource is equivalent to another value.

Parameters

$left
The resource to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP resource
abstract protected boolean
# equivalentString( string $left, mixed $right )

Checks whether a string is equivalent to another value.

Checks whether a string is equivalent to another value.

Parameters

$left
The string value to compare.
$right
The other value to compare.

Returns

boolean

Returns true if the given values are considered equivalent, false otherwise.

Link

PHP string
Methods inherited from PhpCommon\Comparison\Equatable
equals()
Constants summary
string TYPE_ARRAY

Constant that represents the primitive type array .

Constant that represents the primitive type array .

# 'array'
string TYPE_BOOLEAN

Constant that represents the primitive type boolean.

Constant that represents the primitive type boolean.

# 'boolean'
string TYPE_DOUBLE

Constant that represents the primitive type double.

Constant that represents the primitive type double.

# 'double'
string TYPE_INTEGER

Constant that represents the primitive type integer.

Constant that represents the primitive type integer.

# 'integer'
string TYPE_NULL

Constant that represents the primitive type NULL.

Constant that represents the primitive type NULL.

# 'NULL'
string TYPE_OBJECT

Constant that represents the primitive type object.

Constant that represents the primitive type object.

# 'object'
string TYPE_RESOURCE

Constant that represents the primitive type resource.

Constant that represents the primitive type resource.

# 'resource'
string TYPE_STRING

Constant that represents the primitive type string.

Constant that represents the primitive type string.

# 'string'
PHPCommon Comparison API API documentation generated by ApiGen