src/Schema.php
private function validateNumberProperties($value, ValidationField $field) {
        $count = $field->getErrorCount();

        if ($multipleOf = $field->val('multipleOf')) {
            $divided = $value / $multipleOf;

            if ($divided != round($divided)) {
                $field->addError('multipleOf', ['messageCode' => 'The value must be a multiple of {multipleOf}.', 'multipleOf' => $multipleOf]);
            }
        }

        if ($maximum = $field->val('maximum')) {
            $exclusive = $field->val('exclusiveMaximum');

            if ($value > $maximum || ($exclusive && $value == $maximum)) {
                if ($exclusive) {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than {maximum}.', 'maximum' => $maximum]);
                } else {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than or equal to {maximum}.', 'maximum' => $maximum]);
                }
            }
        }

        if ($minimum = $field->val('minimum')) {
            $exclusive = $field->val('exclusiveMinimum');

            if ($value < $minimum || ($exclusive && $value == $minimum)) {
                if ($exclusive) {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than {minimum}.', 'minimum' => $minimum]);
                } else {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than or equal to {minimum}.', 'minimum' => $minimum]);
                }
            }
        }

        return $field->getErrorCount() === $count ? $value : Invalid::value();
    }
private function validateNumberProperties($value, ValidationField $field) {
        $count = $field->getErrorCount();

        if ($multipleOf = $field->val('multipleOf')) {
            $divided = $value / $multipleOf;

            if ($divided != round($divided)) {
                $field->addError('multipleOf', ['messageCode' => 'The value must be a multiple of {multipleOf}.', 'multipleOf' => $multipleOf]);
            }
        }

        if ($maximum = $field->val('maximum')) {
            $exclusive = $field->val('exclusiveMaximum');

            if ($value > $maximum || ($exclusive && $value == $maximum)) {
                if ($exclusive) {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than {maximum}.', 'maximum' => $maximum]);
                } else {
                    $field->addError('maximum', ['messageCode' => 'The value must be less than or equal to {maximum}.', 'maximum' => $maximum]);
                }
            }
        }

        if ($minimum = $field->val('minimum')) {
            $exclusive = $field->val('exclusiveMinimum');

            if ($value < $minimum || ($exclusive && $value == $minimum)) {
                if ($exclusive) {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than {minimum}.', 'minimum' => $minimum]);
                } else {
                    $field->addError('minimum', ['messageCode' => 'The value must be greater than or equal to {minimum}.', 'minimum' => $minimum]);
                }
            }
        }

        return $field->getErrorCount() === $count ? $value : Invalid::value();
    }
private function validateNumberProperties ( $ value , ValidationField $ field ) { $ count = $ field -> getErrorCount ( ) ; if ( $ multipleOf = $ field -> val ( 'multipleOf' ) ) { $ divided = $ value / $ multipleOf ; if ( $ divided != round ( $ divided ) ) { $ field -> addError ( 'multipleOf' , [ 'messageCode' => 'The value must be a multiple of {multipleOf}.' , 'multipleOf' => $ multipleOf ] ) ; } } if ( $ maximum = $ field -> val ( 'maximum' ) ) { $ exclusive = $ field -> val ( 'exclusiveMaximum' ) ; if ( $ value > $ maximum || ( $ exclusive && $ value == $ maximum ) ) { if ( $ exclusive ) { $ field -> addError ( 'maximum' , [ 'messageCode' => 'The value must be less than {maximum}.' , 'maximum' => $ maximum ] ) ; } else { $ field -> addError ( 'maximum' , [ 'messageCode' => 'The value must be less than or equal to {maximum}.' , 'maximum' => $ maximum ] ) ; } } } if ( $ minimum = $ field -> val ( 'minimum' ) ) { $ exclusive = $ field -> val ( 'exclusiveMinimum' ) ; if ( $ value < $ minimum || ( $ exclusive && $ value == $ minimum ) ) { if ( $ exclusive ) { $ field -> addError ( 'minimum' , [ 'messageCode' => 'The value must be greater than {minimum}.' , 'minimum' => $ minimum ] ) ; } else { $ field -> addError ( 'minimum' , [ 'messageCode' => 'The value must be greater than or equal to {minimum}.' , 'minimum' => $ minimum ] ) ; } } } return $ field -> getErrorCount ( ) === $ count ? $ value : Invalid :: value ( ) ; }
Validate specific numeric validation properties.

@param int|float $value The value to test.
@param ValidationField $field Field information.
@return int|float|Invalid Returns the number of invalid.
Validate specific numeric validation properties .