Documentation

DateTimeComparator extends ObjectComparator
in package

Compares DateTimeInterface instances for equality.

Table of Contents

Properties

$exporter  : Exporter
$factory  : Factory

Methods

__construct()  : mixed
accepts()  : bool
Returns whether the comparator can compare two values.
assertEquals()  : mixed
Asserts that two values are equal.
setFactory()  : mixed
indent()  : mixed
toArray()  : array<string|int, mixed>
Converts an object to an array containing all of its private, protected and public properties.
dateTimeToString()  : string
Returns an ISO 8601 formatted string representation of a datetime or 'Invalid DateTimeInterface object' if the provided DateTimeInterface was not properly initialized.

Properties

Methods

accepts()

Returns whether the comparator can compare two values.

public accepts(mixed $expected, mixed $actual) : bool
Parameters
$expected : mixed

The first value to compare

$actual : mixed

The second value to compare

Return values
bool

assertEquals()

Asserts that two values are equal.

public assertEquals(mixed $expected, mixed $actual[, float $delta = 0.0 ][, bool $canonicalize = false ][, bool $ignoreCase = false ][, array<string|int, mixed> &$processed = [] ]) : mixed
Parameters
$expected : mixed

First value to compare

$actual : mixed

Second value to compare

$delta : float = 0.0

Allowed numerical distance between two values to consider them equal

$canonicalize : bool = false

Arrays are sorted before comparison when set to true

$ignoreCase : bool = false

Case is ignored when set to true

$processed : array<string|int, mixed> = []

List of already processed elements (used to prevent infinite recursion)

Tags
throws
Exception
throws
ComparisonFailure

indent()

protected indent(mixed $lines) : mixed
Parameters
$lines : mixed

toArray()

Converts an object to an array containing all of its private, protected and public properties.

protected toArray(object $object) : array<string|int, mixed>
Parameters
$object : object
Return values
array<string|int, mixed>

dateTimeToString()

Returns an ISO 8601 formatted string representation of a datetime or 'Invalid DateTimeInterface object' if the provided DateTimeInterface was not properly initialized.

private dateTimeToString(DateTimeInterface $datetime) : string
Parameters
$datetime : DateTimeInterface
Return values
string

        
On this page

Search results