NumberComparator.php in Commerce Core 8.2
File
modules/price/src/Comparator/NumberComparator.php
View source
<?php
namespace Drupal\commerce_price\Comparator;
use SebastianBergmann\Comparator\Comparator;
use SebastianBergmann\Comparator\ComparisonFailure;
class NumberComparator extends Comparator {
public function accepts($expected, $actual) {
return is_string($expected) && is_numeric($expected) && is_string($actual) && is_numeric($actual);
}
public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = FALSE, $ignoreCase = FALSE) {
if ($expected != $actual) {
throw new ComparisonFailure($expected, $actual, '', '', FALSE, sprintf('Failed asserting that "%s" matches expected "%s".', $actual, $expected));
}
}
}