Verify that the count parameter is in range

@param int $count
@param int $min
@param int $max

@return int
504024
protected function getVerifiedCount($count, $min = 1, $max = 100)
    {
        settype($count, "integer");
        settype($min, "integer");
        settype($max, "integer");

        // If $min is greater than $max,
        // use the smallest of the two ($max)
        if ($min > $max) $min = $max;

        if ($count < $min)
        {
            $count = $min;
        }
        elseif ($count > $max)
        {
            $count = $max;
        }

        return $count;
    }
295301
private static function calculateMeanMicroAmount($min, $max)
    {
        if ($min === null || $max === null) {
            return null;
        }
        if ($min->getMicroAmount() === null
            || $max->getMicroAmount() === null) {
            return null;
        }

        return ($min->getMicroAmount() + $max->getMicroAmount()) / 2;
    }
951138
public function setMincount($mincount, $field = null)
    {
        $param = $this->buildParam('facet.mincount', $field);
        return $this->set($param, $mincount);
    }
505103
public function countArray($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(!is_array($this->value)||count($this->value) < $min || count($this->value) > $max, false);
    }
1044036
public function length($min, $max = null) {
        if (!$this->_isValid) {
            return $this;
        }
        $c = count($this->_unsafeVar);
        if ($c < $min || (null !== $max && $c > $max)) {
            $this->_isValid = false;
        }
        return $this;
    }
875463
public function whereDateBetween($field, $min, $max)
    {
        foreach ($this->queries as $query) {
            $query->whereDateBetween($field, $min, $max);
        }

        return $this;
    }
1055075
public static function size($val, $min = null, $max = null): bool
    {
        if (!\is_int($val)) {
            if (\is_string($val)) {
                $val = Helper::strlen(\trim($val));
            } elseif (\is_array($val)) {
                $val = \count($val);
            } else {
                return false;
            }
        }

        return self::integer($val, $min, $max);
    }
968595
public function integerIsBetween(int $integer, int $min, int $max): bool
    {
        return (($integer >= $min) && ($integer <= $max));
    }
912384
private function isValidResult($number, $min, $max)
    {
        return is_int($number) && $number >= $min && $number <= $max;
    }
41810
public function rule_between( $key, $value, $min, $max )
	{
		return $this->rule_between_num( $key, strlen( $value ), $min, $max );
	}
640627
public function whereBetween($field, $min, $max)
    {
        foreach ($this->queries as $query) {
            $query->whereBetween($field, $min, $max);
        }

        return $this;
    }
749967
public static function isOptionalNumberRange($value, $min, $max)
    {
        /* No additional validations when the value is null. */
        if (null === $value) {

            return true;
        }

        return self::isRequiredNumberRange($value, $min, $max);
    }
870767
public function release($count)
    {
        $count = min($count, $this->size);

        if (!$count) {
            return;
        }

        $this->size -= $count;
        call_user_func($this->releaseFn, $count);
    }
1066318
public function getInteger($min, $max)
    {
        $min = (int) $min;
        $max = (int) $max;

        if ($this->isOutOfBounds($min, 0, $max)) {
            throw new \InvalidArgumentException('Invalid minimum or maximum value');
        }

        return $this->generator->getNumber($min, $max);
    }
207153
public function vLimit(Int $min = 0, Int $max = NULL)
    {
        $key['minchar'] = [':p1' => $min];
        $typ['minchar'] = $min;

        if( $max !== NULL )
        {
            $key['maxchar'] = [':p1' => $max];
            $typ['maxchar'] = $max;
        }

        return $this->onInvalidEventPattern('.{' . $min . ',' . $max . '}', $key, [], $typ);
    }
480742
public function count($min=0, $max=-1)
        {
                if($min!=0 or $max!=-1) {
                        return $this->_redis->zcount($this->_key, $min, $max);
                } else {
                        return $this->_redis->zcard($this->_key);
                }
        }
805226
public function setIDRange($min, $max)
    {
        assert(is_numeric($min));
        assert(is_numeric($max));
        assert($min <= $max);
        $this->_min_id = $min;
        $this->_max_id = $max;

        return $this;
    }