src/Koldy/Validator.php
protected function validateMinLength($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        if (count($args) == 0) {
            throw new ValidatorConfigException('Validator \'minLength\' has to have defined minimum value');
        }

        if (!is_numeric($args[0])) {
            throw new ValidatorConfigException('Validator \'minLength\' has non-numeric value');
        }

        //$value = $this->getValue($parameter);

        $minLength = (int)$args[0];

        if ($minLength < 0) {
            throw new ValidatorConfigException('Validator \'minLength\' can not have negative minimum length');
        }

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

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

        $value = trim((string)$value);

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

        if (mb_strlen($value, Application::getEncoding()) < $minLength) {
            return Message::getMessage(Message::MIN_LENGTH, [
                'param' => $parameter,
                'min' => $minLength,
                'value' => $value
            ]);
        }

        return null;
    }
protected function validateMinLength($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        if (count($args) == 0) {
            throw new ValidatorConfigException('Validator \'minLength\' has to have defined minimum value');
        }

        if (!is_numeric($args[0])) {
            throw new ValidatorConfigException('Validator \'minLength\' has non-numeric value');
        }

        //$value = $this->getValue($parameter);

        $minLength = (int)$args[0];

        if ($minLength < 0) {
            throw new ValidatorConfigException('Validator \'minLength\' can not have negative minimum length');
        }

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

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

        $value = trim((string)$value);

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

        if (mb_strlen($value, Application::getEncoding()) < $minLength) {
            return Message::getMessage(Message::MIN_LENGTH, [
                'param' => $parameter,
                'min' => $minLength,
                'value' => $value
            ]);
        }

        return null;
    }
protected function validateMinLength ( $ value , string $ parameter , array $ args = [ ] , array $ rules = null , array $ context = null ) : ? string { if ( count ( $ args ) == 0 ) { throw new ValidatorConfigException ( 'Validator \'minLength\' has to have defined minimum value' ) ; } if ( ! is_numeric ( $ args [ 0 ] ) ) { throw new ValidatorConfigException ( 'Validator \'minLength\' has non-numeric value' ) ; } //$value = $this->getValue($parameter); $ minLength = ( int ) $ args [ 0 ] ; if ( $ minLength < 0 ) { throw new ValidatorConfigException ( 'Validator \'minLength\' can not have negative minimum length' ) ; } if ( $ value === null ) { return null ; } if ( ! is_scalar ( $ value ) ) { return Message :: getMessage ( Message :: PRIMITIVE , [ 'param' => $ parameter ] ) ; } $ value = trim ( ( string ) $ value ) ; if ( $ value === '' ) { return null ; } if ( mb_strlen ( $ value , Application :: getEncoding ( ) ) < $ minLength ) { return Message :: getMessage ( Message :: MIN_LENGTH , [ 'param' => $ parameter , 'min' => $ minLength , 'value' => $ value ] ) ; } return null ; }
Validate minimum length of value. If value is numeric, it'll be converted to string

@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' => 'minLength:5'
@throws Exception
@deprecated due to ability to use $rules
Validate minimum length of value . If value is numeric it ll be converted to string