3 * This file is part of the Comparator package.
5 * (c) Sebastian Bergmann <sebastian@phpunit.de>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace SebastianBergmann\Comparator;
13 use SebastianBergmann\Exporter\Exporter;
16 * Abstract base class for comparators which compare values for equality.
18 abstract class Comparator
30 public function __construct()
32 $this->exporter = new Exporter;
36 * @param Factory $factory
38 public function setFactory(Factory $factory)
40 $this->factory = $factory;
44 * Returns whether the comparator can compare two values.
46 * @param mixed $expected The first value to compare
47 * @param mixed $actual The second value to compare
50 abstract public function accepts($expected, $actual);
53 * Asserts that two values are equal.
55 * @param mixed $expected First value to compare
56 * @param mixed $actual Second value to compare
57 * @param float $delta Allowed numerical distance between two values to consider them equal
58 * @param bool $canonicalize Arrays are sorted before comparison when set to true
59 * @param bool $ignoreCase Case is ignored when set to true
61 * @throws ComparisonFailure
63 abstract public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false);