src/Koldy/Validator.php
protected function validateInteger($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        //$value = $this->getValue($parameter);

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = (string)$value;

        if ($value === '') {
            return null;
        }

        if (!is_numeric($value)) {
            return Message::getMessage(Message::NUMERIC, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        if ($value[0] == '-') {
            $value = substr($value, 1);
        }

        if (!ctype_digit($value)) {
            return Message::getMessage(Message::INTEGER, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        return null;
    }
protected function validateInteger($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        //$value = $this->getValue($parameter);

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = (string)$value;

        if ($value === '') {
            return null;
        }

        if (!is_numeric($value)) {
            return Message::getMessage(Message::NUMERIC, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        if ($value[0] == '-') {
            $value = substr($value, 1);
        }

        if (!ctype_digit($value)) {
            return Message::getMessage(Message::INTEGER, [
                'param' => $parameter,
                'value' => $value
            ]);
        }

        return null;
    }
protected function validateInteger ( $ value , string $ parameter , array $ args = [ ] , array $ rules = null , array $ context = null ) : ? string { //$value = $this->getValue($parameter); if ( $ value === null ) { return null ; } if ( ! is_scalar ( $ value ) ) { return Message :: getMessage ( Message :: PRIMITIVE , [ 'param' => $ parameter ] ) ; } $ value = ( string ) $ value ; if ( $ value === '' ) { return null ; } if ( ! is_numeric ( $ value ) ) { return Message :: getMessage ( Message :: NUMERIC , [ 'param' => $ parameter , 'value' => $ value ] ) ; } if ( $ value [ 0 ] == '-' ) { $ value = substr ( $ value , 1 ) ; } if ( ! ctype_digit ( $ value ) ) { return Message :: getMessage ( Message :: INTEGER , [ 'param' => $ parameter , 'value' => $ value ] ) ; } return null ; }
Validate if given value is integer. If you need to validate min and max, then chain those validators

@param mixed $value
@param string $parameter
@param array $args
@param array $rules other rules
@param array|null $context

@return null|string
@throws ValidatorConfigException
@example 'param' => 'integer' - passed value must contain 0-9 digits only
Validate if given value is integer . If you need to validate min and max then chain those validators