@param mixed $var
@param bool $include_zero
@param int $min
@param int $max

@return bool|\WP_Error
359885
protected function validate_positive_float( $var, $include_zero = false, $min = null, $max = null ) {
		$validate = $this->validate_float( $var, $min, $max );
		if ( true === $validate ) {
			return $this->validate_positive( $var, $include_zero );
		}

		return $validate;
	}
324948
public static function dumpScalar($var, $maxValueLen)
    {
        switch (true) {
            case is_null($var):
                $val = 'null';
                break;
            case is_bool($var):
                $val = ($var ? 'true' : 'false');
                break;
            case is_integer($var):
                $val = sprintf('%d', $var);
                break;
            case is_float($var):
                $val = sprintf('%F', $var);
                break;
            case is_string($var):
                $val = self::formatString($var, $maxValueLen);
                break;
            case is_resource($var):
                $val = 'resource (' . get_resource_type($var) . ')';
                break;
            default:
                $val = gettype($var) . ' (unknown scalar type)';
                break;
        }
        return $val;
    }
1164908
public static function numberLimit($val, $min, $max)
    {
        return ($val > $min ? ($val < $max ? $val : $max) : $min);
    }
1342742
public static function isBetween($value, $min, $max, $inclusive = false)
    {
        \settype($value, 'int');
        \settype($min, 'int');
        \settype($max, 'int');

        if ($min > $max) {
            throw new \InvalidArgumentException(\sprintf('%s cannot be less than %s for validation', $min, $max));
        }

        if (false === $inclusive) {
            return (($value > $min) && ($value < $max));
        }

        return (($value >= $min) && ($value <= $max));
    }
450603
protected function validate_positive( $var, $include_zero = false ) {
		if ( ! is_numeric( $var ) ) {
			return new \WP_Error( 400, $this->app->translate( 'Invalid format.' ) );
		}
		if ( ( ! $include_zero && $var <= 0 ) || ( $include_zero && $var < 0 ) ) {
			return new \WP_Error( 400, $this->app->translate( 'Outside the range of allowed values.' ) );
		}

		return true;
	}
385529
private function includeFact(Fact $fact, Date $min_date, Date $max_date): bool
    {
        $fact_date = $fact->date();

        return $fact_date->isOK() && Date::compare($min_date, $fact_date) <= 0 && Date::compare($fact_date, $max_date) <= 0;
    }
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);
    }
1035569
public function rule_min( $key, $value, $min )
	{
		return $this->rule_min_num( $key, strlen( $value ), $min );
	}
297970
public function minMax($min, $max=PHP_INT_MAX){
        return $this->markErrorIf($this->value < $min || $this->value > $max);
    }
554453
public static function ip_in_range(string $ip, $min, $max=null) {
		ref\sanitize::ip($ip, true);
		if (! \is_string($min)) {
			return false;
		}

		// Bad IP.
		if (! $ip) {
			return false;
		}

		// Is $min a range?
		if (false !== \strpos($min, '/')) {
			if (false === ($range = format::cidr_to_range($min))) {
				return false;
			}
			$min = $range['min'];
			$max = $range['max'];
		}
		// Max is required otherwise.
		elseif (null === $max) {
			return false;
		}

		// Convert everything to a number.
		ref\format::ip_to_number($ip);
		ref\format::ip_to_number($min);
		ref\format::ip_to_number($max);

		if (
			(false !== $ip) &&
			(false !== $min) &&
			(false !== $max)
		) {
			return static::in_range($ip, $min, $max);
		}

		return false;
	}
629336
public static function length($val, $minLen = 0, $maxLen = null): bool
    {
        if (!\is_string($val) && !\is_array($val)) {
            return false;
        }

        return self::size($val, $minLen, $maxLen);
    }
867297
public static function int($min, $max)
    {
        $int = self::php7Int($min, $max);
        if (! isset($int)) {
            $int = self::bytesToInt($min, $max);
        }
        return $int;
    }
1104071
public static function within($min, $max, $value)
    {
        Arguments::define(
            Boa::either(Boa::integer(), Boa::float()),
            Boa::either(Boa::integer(), Boa::float()),
            Boa::either(Boa::integer(), Boa::float())
        )->check($min, $max, $value);

        if ($min > $max) {
            throw new LackOfCoffeeException(
                'Max value is less than the min value.'
            );
        }

        return ($min <= $value && $max >= $value);
    }
934801
protected function addWhereBetween(string $key, int $min, int $max): void
    {
        $phMin = $this->addBindingValue($key, $min);
        $phMax = $this->addBindingValue($key, $max);
        $key = $this->quoteName($key);
        $this->statement .= sprintf('%s BETWEEN %s AND %s', $key, $phMin, $phMax);
        $this->statement .= PHP_EOL;
    }
1261921
public function readLittleEndian64(&$var)
    {
        $data = null;
        if (!$this->readRaw(4, $data)) {
            return false;
        }
        $low = unpack('V', $data)[1];
        if (!$this->readRaw(4, $data)) {
            return false;
        }
        $high = unpack('V', $data)[1];
        if (PHP_INT_SIZE == 4) {
            $var = GPBUtil::combineInt32ToInt64($high, $low);
        } else {
            $var = ($high << 32) | $low;
        }
        return true;
    }
1300971
def _prnt_min_max_val(var, text, verb):
    """
    if var.size > 3:
        print(text, _strvar(var.min()), "-", _strvar(var.max()),
              ":", _strvar(var.size), " [min-max; #]")
        if verb > 3:
            print("                   : ", _strvar(var))
    else:
        print(text, _strvar(np.atleast_1d(var)))
1334510
public function rule_between_num( $key, $value, $min, $max )
	{
		if ( !$this->rule_min_num( $key, $value, $min ) )
		{
			return false;
		}
		if ( !$this->rule_max_num( $key, $value, $max ) )
		{
			return false;
		}
		return true;
	}