Sets the max line length

Max line length should be a positive integer less than 998.

@param int $maxLineLength The max line length

@return Message
326696
public function setMaxLineLength(int $maxLineLength): Message
    {
        // Each line of characters MUST be no more than 998 characters,
        // and SHOULD be no more than 78 characters, excluding the CRLF.
        // https://tools.ietf.org/html/rfc5322#section-2.1.1
        $maxLineLength = (int) abs($maxLineLength);

        if ($maxLineLength > 998) {
            $maxLineLength = 998;
        }

        $this->maxLineLength = $maxLineLength;

        return $this;
    }
352429
public function increaseLength($minLength = 100)
    {
        $length = \max($minLength, 100);

        if (\feof($this->stream) || $this->getTotalLength() === $this->position + $this->bufferLength) {
            return false;
        }

        $newLength = $this->bufferLength + $length;
        do {
            $this->buffer .= \fread($this->stream, $newLength - $this->bufferLength);
            $this->bufferLength = \strlen($this->buffer);
        } while (($this->bufferLength !== $newLength) && !\feof($this->stream));

        return true;
    }
1220551
public function setLength($length)
    {
        if ($length <= 0) {
            throw new InvalidArgumentException(sprintf('Supplied bar length: %d must be greater than 0', $length));
        }
        $this->length = $length;
        return $this;
    }
258118
private function __validateString($string, $minLength = 1, $maxLength = 0)
    {
        if (!is_string($string)) {
            $this->error = 'parameter is not string.';
            return false;
        } else if ($maxLength > 0 && strlen($string) > $maxLength) {
            $this->error = 'parameter is too long. string:' . $string;
            return false;
        } else if (strlen($string) < $minLength) {
            $this->error = 'parameter is too short. string:' . $string;
            return false;
        }
        return true;
    }
743170
public function setLineLength($lineLength)
    {
        $this->lineLength = null === $lineLength ? null : (int)$lineLength;
        return $this;
    }
1278009
public static function shorten($text, $maxlength = 140, $end = '[...]') {
        $maxlength++;
        if (mb_strlen($text) > $maxlength) {
            $subex = mb_substr($text, 0, $maxlength - 5);
            $exwords = explode(' ', $subex);
            $excut = - (mb_strlen($exwords[count($exwords)-1]));
            if ($excut < 0) {
                $text = mb_substr($subex, 0, $excut);
            } else {
                $text = $subex;
            }
            $text .= $end;
        }
        return $text;
    }
886709
def _validate_maxlength(self, max_length, field, value):
        
        if isinstance(value, Iterable) and len(value) > max_length:
            self._error(field, errors.MAX_LENGTH, len(value))
997660
public static function readline(StreamInterface $stream, $maxLength = null)
    {
        $buffer = '';
        $size = 0;

        while (!$stream->eof()) {
            if (false === ($byte = $stream->read(1))) {
                return $buffer;
            }
            $buffer .= $byte;
            // Break when a new line is found or the max length - 1 is reached
            if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
                break;
            }
        }

        return $buffer;
    }
1289388
public function setLength(int $length) : self
    {
        $this->minLength = $length;
        $this->maxLength = $length;

        return $this;
    }
360287
public function setLength($length)
    {
        $length = intval($length);
        $this->length = empty($length) ? 1 : $length;

        return $this;
    }
1173580
public function setMaxWidth($maxWidth)
    {
        $maxWidth = (int) $maxWidth;
        $this->maxWidth = $maxWidth > 0 ? $maxWidth : null;
    }
671106
public function getMaxLineWidth()
    {
        $m = $this->getMargins();
        if ($this->getRTL()) {
            return ($this->getRemainingWidth() + $m['right']);
        }

        return ($this->getRemainingWidth() + $m['left']);
    }
64400
public function read(int $maxLength) : string
    {
        if ($this->closed) {
            throw new IoException('The stream is closed.');
        }

        try {
            $data = ErrorCatcher::run(function() use ($maxLength) {
                return fread($this->handle, $maxLength);
            });
        } catch (\ErrorException $e) {
            throw new IoException($e->getMessage(), 0, $e);
        }

        if ($data === false) {
            return '';
        }

        return $data;
    }
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);
    }
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;
    }
81519
public function validateLength($min_length, $max_length)
    {
        $this->validator_attributes[] = 'data-parsley-length="[' . (int)$min_length . ', ' . (int)$max_length . ']"';

        $this->validator_checks['min_length'] = (int)$min_length;
        $this->validator_checks['max_length'] = (int)$max_length;

        return $this;
    }
91931
public function betweenlength($minlength, $maxlength, $message = null)
    {
        $message = empty($message) ? self::getDefaultMessage(__FUNCTION__, array($minlength, $maxlength)) : NULL;

        $this->minlength($minlength, $message)->max($maxlength, $message);
        return $this;
    }