Optional value is integer in range.

@param mixed $value Value.
@param int   $min   Lower limit.
@param int   $max   Upper limit.

@return bool
496179
public static function isOptionalIntegerRange($value, $min, $max)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredIntegerRange($value, $min, $max);
    }
89823
public static function decimal($value, $min = null, $max = null, $accuracy = null)
    {
        // 最小值
        if(null !== $min && $value < $min)
        {
            return false;
        }
        // 最大值
        if(null !== $max && $value > $max)
        {
            return false;
        }
        // 小数精度
        if(null !== $accuracy)
        {
            return preg_match('/^-?\d+\.\d{1,' . ((int)$accuracy) . '}$/', $value) > 0;
        }
        return true;
    }
629874
public static function limitInteger($int, $min = null, $max = null)
    {
        $int = (int) $int;

        if ($min !== null && $int < $min) {
            $int = $min;
        }

        if ($max !== null && $int > $max) {
            $int = $max;
        }

        return (int) $int;
    }
297970
public function minMax($min, $max=PHP_INT_MAX){
        return $this->markErrorIf($this->value < $min || $this->value > $max);
    }
84834
public static function maxCount($value, int $maxCount): bool
    {
        if (!static::isCountable($value)) {
            return false;
        }

        return count($value) <= $maxCount;
    }
1340198
public static function isLengthLte($value, $min)
    {
        is_array($min) && $min = $min[0];
        return self::isLength($value, 0, $min);
    }
1288130
protected function isValueTooLow($value)
    {
        if ($this->min !== null) {
            if ((function_exists('bcsub') && floatval(bcsub($this->min, $value, 4)) > 0) || $value < $this->min) {
                return true;
            }
        }
        return false;
    }
912384
private function isValidResult($number, $min, $max)
    {
        return is_int($number) && $number >= $min && $number <= $max;
    }
960950
protected function keep_within($value, $min, $max) {
        if ($value < $min) {
            return $min;
        }
        if ($value > $max) {
            return $max;
        }
        return $value;
    }
590812
public static function int(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null])
    {
        $value = (int)$value;
        self::processNum($value, $options);
        return $value;
    }
140145
protected function _validator_max($input, $value, $max) {
		if (!is_string($value) && !is_integer($value) && !is_float($value)) return false;
		if (is_string($value)) $value = (int)$value;
		return $value <= $max;
	}
1125063
public static function minCount($value, int $minCount): bool
    {
        if (!static::isCountable($value)) {
            return false;
        }

        return count($value) >= $minCount;
    }
42785
public static function uInt(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null])
    {
        $value = (int)$value;
        self::processUNum($value, $options);
        return $value;
    }
960532
public static function integer($min=NULL,$max=NULL,$prompt=NULL){
		if(\is_int($min) && \is_int($max))
			return new Rule("integer[{$min}..{$max}]",$prompt);
		return new Rule("integer",$prompt);
	}
1288127
public static function number(int $min = 0, int $max = PHP_INT_MAX) : int
    {
        if ($max === $min) {
            return $max;
        }
        $rand = static::bytes(4);
        $rand = hexdec(bin2hex($rand));

        return $min + abs($rand % ($max - $min + 1));
    }
1199499
public static function isInteger($value, array $options = array())
    {
        if (!self::isNumber($value, $options)) {
            return false;
        }

        if (self::getInteger($value, $options) == self::getFloat($value, $options)) {
            return true;
        }

        return false;
    }
968595
public function integerIsBetween(int $integer, int $min, int $max): bool
    {
        return (($integer >= $min) && ($integer <= $max));
    }