@param $field
@param $value
@param null $message

@return bool|mixed
@throws LengthNotSetException
352640
public function run( $field, $value, $message = null ) {
        $this->field = $field;
        $this->message = $message;
        if($this->length) {
            if ( strlen( $value ) >= $this->length ) {
                return true;
            }
        } else {
            throw new LengthNotSetException("Length must be set before running the validation");
        }

        return false;
    }
319548
static public function length($value, $length, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($value, $message);

            if (mb_strlen($value, $encoding) !== $length) {
                $message = $message ?: sprintf(
                    'Value "%s" has to be %d exactly characters long, but length is %d.',
                    static::stringify($value),
                    $length,
                    mb_strlen($value, $encoding)
                );

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

                throw static::createException($value, $message, static::INVALID_LENGTH, $propertyPath, $constraints);
            }
        }
1001440
public static function length($value, $min = null, $max = null)
    {
        $length = mb_strlen($value);

        if (is_numeric($min) && $min > 0 && $length < $min) {
            return false;
        }

        if (is_numeric($max) && $max > 0 && $length > $max) {
            return false;
        }

        return true;
    }
1057561
static public function maxLength($value, $maxLength, $message = null, $propertyPath = null, $encoding = 'utf8')
        {
            static::string($value, $message);

            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);
            }
        }
1299025
public static function isNullOrFloat($value, $message = null)
    {
        if (!is_null($value) && !is_float($value)) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or float, but got %s',
                Helper::typeToString($value)
            ));
        }
    }
973361
public static function checkLength($field, $length, $msg)
    {
        if ((StringUtils::isEmpty($field) === false) && mb_strlen($field) != $length) {
            throw new MsgException($msg);
        }
    }
47403
public function set(string $field, $value)
    {
        if ($value === null)
            $value = "";

        switch ($field)
        {
            case "scheme":
                $this->scheme = strtolower($value);
                return $this;
            case "port":
                $value = empty($value) ? null : (int)$value;
            case "username":
            case "password":
            case "fragment":
                $this->$field = $value;
                return $this;
            case "query":
                $this->query = $this->parseQuery($value);
                return $this;
            case "path":
                $this->setPath($value);
                return $this;
            case "host":
                return $this->setHost($value);
        }
        throw new \OutOfRangeException($field);
    }
1336343
public static function invalidCardString($value, $message = null)
    {
        $defaultMessage = sprintf('Cannot create card from string given: "%s"', $value);
        $message = is_null($message) ? $defaultMessage : $message;

        return new static($message);
    }
581626
static public function integer($value, $message = null, $propertyPath = null)
        {
            if ( ! is_int($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" is not an integer.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_INTEGER, $propertyPath);
            }
        }
481555
public static function maxLength($value, $length)
    {
        return Validator::string()->length(null, $length)->validate($value);
    }
551745
public static function length($value, $encoding = null)
    {
        if ($encoding !== null) {
            return mb_strlen($value, $encoding);
        }

        return mb_strlen($value);
    }
1260027
static public function string($value, $message = null, $propertyPath = null)
        {
            if ( ! is_string($value)) {
                $message = $message ?: sprintf(
                    'Value "%s" expected to be string, type %s given.',
                    static::stringify($value),
                    gettype($value)
                );

                throw static::createException($value, $message, static::INVALID_STRING, $propertyPath);
            }
        }
488720
static public function false($value, $message = null, $propertyPath = null)
        {
            if ($value !== false) {
                $message = $message ?: sprintf(
                    'Value "%s" is not FALSE.',
                    static::stringify($value)
                );

                throw static::createException($value, $message, static::INVALID_FALSE, $propertyPath);
            }
        }
633035
public static function rangeLength($value, array $param)
    {
        $length = is_array($value) ? count($value) : mb_strlen($value);

        return $length >= $param[0] && $length <= $param[1];
    }
76383
public static function isNullOrInstanceOf($value, $class, $message = null)
    {
        if (!is_null($value) && !$value instanceof $class) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or instance of %2$s, but got %s',
                Helper::typeToString($value),
                $class
            ));
        }
    }
1126587
protected function _validate_length($value, $parameter)
    {
        $len = mb_strlen($value);
        if (preg_match('#^(\d+)-(\d+)$#', $parameter, $match)) {
            return $len >= $match[1] && $len <= $match[2] ? $value : null;
        } else {
            throw new InvalidValueException(['length validator `:parameter` parameters is not {minLength}-{maxLength} format', 'parameter' => $parameter]);
        }
    }
609436
public static function isNullOrArray($value, $message = null)
    {
        if (!is_null($value) && !is_array($value)) {
            throw new InvalidArgumentException(sprintf(
                $message ?: 'Expected null or array, but got %s',
                Helper::typeToString($value)
            ));
        }
    }