Assert\Assertion::between PHP Method

between() public static method

Assert that a value is greater or equal than a lower limit, and less than or equal to an upper limit.
public static between ( mixed $value, mixed $lowerLimit, mixed $upperLimit, string $message = null, string $propertyPath = null ) : boolean
$value mixed
$lowerLimit mixed
$upperLimit mixed
$message string
$propertyPath string
return boolean
    public static function between($value, $lowerLimit, $upperLimit, $message = null, $propertyPath = null)
    {
        if ($lowerLimit > $value || $value > $upperLimit) {
            $message = sprintf($message ?: 'Provided "%s" is neither greater than or equal to "%s" nor less than or equal to "%s".', static::stringify($value), static::stringify($lowerLimit), static::stringify($upperLimit));
            throw static::createException($value, $message, static::INVALID_BETWEEN, $propertyPath);
        }
        return true;
    }