Comparator.php 838 B

1234567891011121314151617181920212223242526272829303132
  1. <?php declare(strict_types=1);
  2. /*
  3. * This file is part of sebastian/comparator.
  4. *
  5. * (c) Sebastian Bergmann <sebastian@phpunit.de>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace SebastianBergmann\Comparator;
  11. abstract class Comparator
  12. {
  13. private Factory $factory;
  14. public function setFactory(Factory $factory): void
  15. {
  16. $this->factory = $factory;
  17. }
  18. abstract public function accepts(mixed $expected, mixed $actual): bool;
  19. /**
  20. * @throws ComparisonFailure
  21. */
  22. abstract public function assertEquals(mixed $expected, mixed $actual, float $delta = 0.0, bool $canonicalize = false, bool $ignoreCase = false): void;
  23. protected function factory(): Factory
  24. {
  25. return $this->factory;
  26. }
  27. }