protected function validateNumberType($value, array $schema): ErrorResult
    {
        $result = new ErrorResult();
        if (is_numeric($value) === false) {
            $result->addError($this->createError('type=number', 'type=' . gettype($value)));
            return $result;
        }

        if (isset($schema['maximum'])) {
            if (isset($schema['exclusiveMaximum']) && $schema['exclusiveMaximum'] === true) {
                if ($value >= $schema['maximum']) {
                    $result->addError($this->createError('maximum(exclusive)=' . $schema['maximum'], $value));
                }
            } else {
                if ($value > $schema['maximum']) {
                    $result->addError($this->createError('maximum=' . $schema['maximum'], $value));
                }
            }
        }

        if (isset($schema['minimum'])) {
            if (isset($schema['exclusiveMinimum']) && $schema['exclusiveMinimum'] === true) {
                if ($value <= $schema['minimum']) {
                    $result->addError($this->createError('minimum(exclusive)=' . $schema['minimum'], $value));
                }
            } else {
                if ($value < $schema['minimum']) {
                    $result->addError($this->createError('minimum=' . $schema['minimum'], $value));
                }
            }
        }

        if (isset($schema['divisibleBy']) && $value % $schema['divisibleBy'] !== 0) {
            $result->addError($this->createError('divisibleBy=' . $schema['divisibleBy'], $value));
        }

        return $result;
    }
protected function validateNumberType($value, array $schema): ErrorResult
    {
        $result = new ErrorResult();
        if (is_numeric($value) === false) {
            $result->addError($this->createError('type=number', 'type=' . gettype($value)));
            return $result;
        }

        if (isset($schema['maximum'])) {
            if (isset($schema['exclusiveMaximum']) && $schema['exclusiveMaximum'] === true) {
                if ($value >= $schema['maximum']) {
                    $result->addError($this->createError('maximum(exclusive)=' . $schema['maximum'], $value));
                }
            } else {
                if ($value > $schema['maximum']) {
                    $result->addError($this->createError('maximum=' . $schema['maximum'], $value));
                }
            }
        }

        if (isset($schema['minimum'])) {
            if (isset($schema['exclusiveMinimum']) && $schema['exclusiveMinimum'] === true) {
                if ($value <= $schema['minimum']) {
                    $result->addError($this->createError('minimum(exclusive)=' . $schema['minimum'], $value));
                }
            } else {
                if ($value < $schema['minimum']) {
                    $result->addError($this->createError('minimum=' . $schema['minimum'], $value));
                }
            }
        }

        if (isset($schema['divisibleBy']) && $value % $schema['divisibleBy'] !== 0) {
            $result->addError($this->createError('divisibleBy=' . $schema['divisibleBy'], $value));
        }

        return $result;
    }
protected function validateNumberType ( $ value , array $ schema ) : ErrorResult { $ result = new ErrorResult ( ) ; if ( is_numeric ( $ value ) === false ) { $ result -> addError ( $ this -> createError ( 'type=number' , 'type=' . gettype ( $ value ) ) ) ; return $ result ; } if ( isset ( $ schema [ 'maximum' ] ) ) { if ( isset ( $ schema [ 'exclusiveMaximum' ] ) && $ schema [ 'exclusiveMaximum' ] === true ) { if ( $ value >= $ schema [ 'maximum' ] ) { $ result -> addError ( $ this -> createError ( 'maximum(exclusive)=' . $ schema [ 'maximum' ] , $ value ) ) ; } } else { if ( $ value > $ schema [ 'maximum' ] ) { $ result -> addError ( $ this -> createError ( 'maximum=' . $ schema [ 'maximum' ] , $ value ) ) ; } } } if ( isset ( $ schema [ 'minimum' ] ) ) { if ( isset ( $ schema [ 'exclusiveMinimum' ] ) && $ schema [ 'exclusiveMinimum' ] === true ) { if ( $ value <= $ schema [ 'minimum' ] ) { $ result -> addError ( $ this -> createError ( 'minimum(exclusive)=' . $ schema [ 'minimum' ] , $ value ) ) ; } } else { if ( $ value < $ schema [ 'minimum' ] ) { $ result -> addError ( $ this -> createError ( 'minimum=' . $ schema [ 'minimum' ] , $ value ) ) ; } } } if ( isset ( $ schema [ 'divisibleBy' ] ) && $ value % $ schema [ 'divisibleBy' ] !== 0 ) { $ result -> addError ( $ this -> createError ( 'divisibleBy=' . $ schema [ 'divisibleBy' ] , $ value ) ) ; } return $ result ; }
Validate an integer value with the given schema

The following properties are handled in given $schema:
- maximum : maximum allowed value
- minimum : minimum allowed value
- exclusiveMinimum : boolean to use exclusive minimum
- exclusiveMaximum : boolean to use exclusive maximum
- divisibleBy : value is divisibleBy the given number

@param mixed $value
@param array $schema
@return ErrorResult
Validate an integer value with the given schema