public function setFilterRange($attribute, $min, $max, $exclude = false)
{
if (!is_string($attribute)) {
throw new \InvalidArgumentException('Attribute name must be a string.');
}
if (!is_numeric($min)) {
throw new \InvalidArgumentException('Minimum value must be numeric.');
}
if (!is_numeric($max)) {
throw new \InvalidArgumentException('Maximum value must be numeric.');
}
if ($min > $max) {
throw new \InvalidArgumentException('Minimum value cannot be larger than maximum value.');
}
$exclude = (bool) $exclude;
$this->filters[] = array('type' => self::SPH_FILTER_RANGE, 'attr' => $attribute, 'exclude' => $exclude, 'min' => $min, 'max' => $max);
return $this;
}