Assert that a string is at least $minLength chars long.

@param mixed $value
@param int $minLength
@param string $message
@param string $propertyPath
@param string $encoding
@return void
@throws Exception
774102
static public function minLength($value, $minLength, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($value, $message);

            if (mb_strlen($value, $encoding) < $minLength) {
                $message = $message ?: sprintf(
                    'Value "%s" is too short, it should have more than %d characters, but only has %d characters.',
                    static::stringify($value),
                    $minLength,
                    mb_strlen($value, $encoding)
                );

                $constraints = array('min_length' => $minLength, 'encoding' => $encoding);

                throw static::createException($value, $message, static::INVALID_MIN_LENGTH, $propertyPath, $constraints);
            }
        }
735916
static public function min($value, $minValue, $message = null, $propertyPath = null)
        {
            static::integer($value);

            if ($value < $minValue) {
                $message = $message ?: sprintf(
                    'Number "%s" was expected to be at least "%d".',
                    static::stringify($value),
                    static::stringify($minValue)
                );

                throw static::createException($value, $message, static::INVALID_MIN, $propertyPath, array('min' => $minValue));
            }
        }
260405
public function minlength($len, $message = null)
    {
        $this->setRule(__FUNCTION__, function($val, $args)
                       {
                           return !(strlen(trim($val)) < $args[0]);
                       }, $message, array($len));
        return $this;
    }
368345
static public function noContent($value, $message = null, $propertyPath = null)
        {
            if (!empty($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not empty, but empty value was expected.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::VALUE_NOT_EMPTY, $propertyPath);
            }
        }
1160515
static public function true($value, $message = null, $propertyPath = null)
        {
            if ($value !== true) {
                $message = $message ?: sprintf(
                    'Value "%s" is not TRUE.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_TRUE, $propertyPath);
            }
        }
810917
static public function notEmpty($value, $message = null, $propertyPath = null)
        {
            if (empty($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is empty, but non empty value was expected.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::VALUE_EMPTY, $propertyPath);
            }
        }
818964
static public function endsWith($string, $needle, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($string);

            $stringPosition = mb_strlen($string, $encoding) - mb_strlen($needle, $encoding);

            if (mb_strripos($string, $needle, null, $encoding) !== $stringPosition) {
                $message = $message ?: sprintf(
                    'Value "%s" does not end with "%s".',
                    static::stringify($string),
                    static::stringify($needle)
                );

                $constraints = array('needle' => $needle, 'encoding' => $encoding);

                throw static::createException($string, $message, static::INVALID_STRING_END, $propertyPath, $constraints);
            }
        }
1069581
static public function notNull($value, $message = null, $propertyPath = null)
        {
            if ($value === null) {
                $message = $message ?: sprintf(
                    'Value "%s" is null, but non null value was expected.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::VALUE_NULL, $propertyPath);
            }
        }
379751
protected function _validator_minlength($input, $value, $min) {
		if (!is_string($value)) return false;
		if (strlen($value) < $min) return false;
		return true;
	}
251389
public static function minLength($value, $param)
    {
        $length = is_array($value) ? count($value) : mb_strlen($value);

        return $length >= $param;
    }
288301
static public function writeable($value, $message = null, $propertyPath = null)
        {
            static::string($value, $message);

            if (!is_writeable($value)) {
                $message = $message ?: sprintf(
                    'Path "%s" was expected to be writeable.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_WRITEABLE, $propertyPath);
            }
        }
911242
public function strPost($key, $minLength = 0, $maxLength = false, $default = false)
	{
		return $this->str($this->post($key), $minLength, $maxLength, $default);
	}
682896
public function str($value, $minLength = 0, $maxLength = false, $default = false)
	{
		$value = trim($value);
		if ((!empty($minLength) && (mb_strlen($value, $this->encoding) < $minLength)) ||
			(!empty($maxLength) && (mb_strlen($value, $this->encoding) > $maxLength))
		) {
			return $default;
		}

		return (string) $value;
	}
666632
protected function setErrorLengthRange($field, $label, $min = 1, $max = 255)
    {
        $vars = array('@min' => $min, '@max' => $max, '@field' => $label);
        $error = $this->translation->text('@field must be @min - @max characters long', $vars);
        return $this->setError($field, $error);
    }
472900
static public function notSame($value1, $value2, $message = null, $propertyPath = null)
        {
            if ($value1 === $value2) {
                $message = $message ?: sprintf(
                    'Value "%s" is the same as expected value "%s".',
                    static::stringify($value1),
                    static::stringify($value2)
                );

                throw static::createException($value1, $message, static::INVALID_NOT_SAME, $propertyPath, array('expected' => $value2));
            }
        }
21246
public static function username(string $value, int $minLength = 5, int $maxLength = 20):bool
    {
        return (bool)preg_match("!^[_a-zA-Z0-9\\x{4e00}-\\x{9fa5}]{" . $minLength . "," . $maxLength . "}$!u", $value);
    }
1130414
static public function numeric($value, $message = null, $propertyPath = null)
        {
            if (!is_numeric($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not numeric.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_NUMERIC, $propertyPath);
            }
        }