Mike42\Escpos\Printer::validateFloat PHP Метод

validateFloat() защищенный статический Метод

Throw an exception if the argument given is not a float within the specified range
protected static validateFloat ( float $test, float $min, float $max, string $source, string $argument = "Argument" )
$test float the input to test
$min float the minimum allowable value (inclusive)
$max float the maximum allowable value (inclusive)
$source string the name of the function calling this
$argument string the name of the invalid parameter
    protected static function validateFloat($test, $min, $max, $source, $argument = "Argument")
    {
        if (!is_numeric($test)) {
            throw new InvalidArgumentException("{$argument} given to {$source} must be a float, but '{$test}' was given.");
        }
        if ($test < $min || $test > $max) {
            throw new InvalidArgumentException("{$argument} given to {$source} must be in range {$min} to {$max}, but {$test} was given.");
        }
    }