String minimum byte/ASCII length.

@see Validate::string()

@param mixed $subject
Checked stringified.
@param int $min
Stringed integer is not accepted.

@return bool

@throws InvalidArgumentException
Arg min not non-negative.
492268
public function minLength($subject, int $min) : bool
    {
        if ($subject === null) {
            return false;
        }
        if ($min < 0) {
            throw new InvalidArgumentException('Arg min[' . $min . '] is not non-negative.');
        }
        return strlen('' . $subject) >= $min;
    }
667418
public function setMinMessage($minMessage)
    {
        if (!is_string($minMessage)) {
            throw new \InvalidArgumentException('The attribute minMessage on the class Attribute has to be string (' . gettype($minMessage) . ('object' === gettype($minMessage) ? ' ' . get_class($minMessage) : '') . ' given).');
        }

        $this->minMessage = $minMessage;

        return $this;
    }
281667
public static function length($val, $min, $max = null)
    {
        return isset($val[$min - 1]) && (null === $max || !isset($val[$max]));
    }
126985
public function trackUse($string, $subject)
    {
        $id = $this->resolveUserID($subject);

        // If the subject is invalid return false
        if (!$id) {
            return false;
        }

        if (!is_string($string)) {
            throw new \InvalidArgumentException(t('Invalid mixed value provided. Must be a string.'));
        }

        if ($this->maxReuse) {
            // Store the use in the database
            $this->entityManager->transactional(function (EntityManagerInterface $em) use ($id, $string) {
                $reuse = new UsedString();
                $reuse->setDate(Carbon::now());
                $reuse->setSubject($id);
                $reuse->setUsedString(password_hash($string, PASSWORD_DEFAULT));

                $em->persist($reuse);
            });
        }

        // Prune extra tracked uses
        $this->pruneUses($id);

        return true;
    }
586910
public function validateEmailSubjectPrefix($subjectPrefix)
    {
        if (mb_strlen($subjectPrefix, 'UTF-8') > 255) {
            $this->addError(EmailConfigurationTransformer::EMAIL_SUBJECT_PREFIX, 'Subject prefix length has to be less or equal to 255');
            return false;
        }

        return true;
    }
982211
public function setMin($min)
    {
        if (is_numeric($min) || Format::isVariableRef($min)) {
            $this->min = $min;
        } else {
            $msg = "'Min' must be a numeric value or a variableRef, '" . gettype($min) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
516235
protected static function stringLengthBetween(int $min, int $max, RuleInterface $next = null): RuleInterface
    {
        return $next === null ?
            new StringLengthBetween($min, $max) :
            new AndOperator(static::stringLengthBetween($min, $max), $next);
    }
1068504
static public function betweenLength($value, $minLength, $maxLength, $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);
            }

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

                $constraints = array('max_length' => $maxLength, 'encoding' => $encoding);

                throw static::createException($value, $message, static::INVALID_MAX_LENGTH, $propertyPath, $constraints);
            }
        }
539950
protected function min_length($name, $value, $min){
        //Si no se completo no se valida
        if(! $this->isComplete($value)){
            return TRUE;
        }
        if(is_string($value) || strval($value)){
            if(strlen($value) < $min){
                $this->add_message($name, 'min_length', array('min' => $min));
                return FALSE;
            }
        }else{
            $this->add_message($name, 'is_string');
            return FALSE;
        }
        return TRUE;
    }
83387
public function _validation_min_length($val, $length)
	{
		return $this->_empty($val) || \Str::length($val) >= $length;
	}
43088
public function isValidStringLength($str, $min = null, $max = null): bool
    {
        $len = mb_strlen($str, 'UTF-8');

        return (($min !== null) && ($len >= $min)) || (($max !== null) && ($len <= $max));
    }
1138650
public static function text($chars, $min, $max)
    {
        $length = mt_rand($min, $max);
        $charLength = mb_strlen($chars);
        $result = '';
        for($i = 0; $i < $length; ++$i)
        {
            $result .= mb_substr($chars, mt_rand(1, $charLength) - 1, 1);
        }
        return $result;
    }
337320
public function setSubject($subject)
    {
        if ($subject === '') {
            throw new \InvalidArgumentException('$subject must not be empty.', 1331488802);
        }

        if ((strpos($subject, CR) !== false) || (strpos($subject, LF) !== false)) {
            throw new \InvalidArgumentException(
                '$subject must not contain any line breaks or carriage returns.',
                1331488817
            );
        }

        $this->setAsString('subject', $subject);
    }
425034
public function strCookie($key, $minLength = 0, $maxLength = false, $default = false)
	{
		return $this->str($this->cookie($key), $minLength, $maxLength, $default);
	}
742563
private function resolveUserID($subject)
    {
        // Handle `null`, `0`, and any other falsy subject
        if (!$subject) {
            return 0;
        }

        // If an integer is just passed in
        if (is_numeric($subject)) {
            return (int)$subject;
        }

        // If we get an actual user instance
        if ($subject instanceof User || $subject instanceof UserInfo || $subject instanceof EntityUser) {
            return $subject->getUserID();
        }

        // Non-falsy subject that is unsupported
        throw new \InvalidArgumentException(t('Unsupported subject provided. Subject must be a User, UserInfo, or User Entity object.'));
    }
678188
public function empty($subject) : bool
    {
        if (!$subject) {
            // Stringed zero - '0' - is not empty.
            return $subject !== '0';
        }
        if (is_object($subject)) {
            if ($subject instanceof \Countable) {
                return !count($subject);
            }
            if ($subject instanceof \Traversable) {
                // No need to check/use ArrayObject|ArrayIterator, because
                // those are both Countable (checked before this check).

                // Have to iterate; horrible.
                foreach ($subject as $ignore) {
                    return false;
                }
                return true;
            }
            if ($subject instanceof \ArrayAccess) {
                return false;
            }
            return !get_object_vars($subject);
        }
        return false;
    }
1323228
public static function isLength($string = false, $minLength = 0, $maxLength = false) {

        if ($string && strlen($string) >= $minLength) {

            if (!$maxLength || strlen($string) <= $maxLength) {

                return true;
            }
        }

        return false;
    }