protected isValidInteger ( $value ) : boolean | ||
return | boolean | true if within integer range. |
protected function isValidInteger($value)
{
$minValue = $this->getMinValue();
$maxValue = $this->getMaxValue();
$valid = preg_match('/^[-+]?[0-9]+$/', trim($value));
$value = intval($value);
if ($minValue !== '') {
$valid = $valid && $this->isGreaterThan($value, intval($minValue));
}
if ($maxValue !== '') {
$valid = $valid && $this->isLessThan($value, intval($maxValue));
}
return $valid;
}