public static function compare($type, $criterion)
{
$inKey = array_search($type, static::$ratings);
$criterionKey = array_search($criterion, static::$ratings);
if ($criterionKey === false) {
throw new UnknownCriterionException(compact('criterion'));
}
if ($inKey == $criterionKey) {
return 0;
}
return $inKey > $criterionKey ? 1 : -1;
}