Forcefully read more data into the buffer.

@param int $minLength
@return bool Returns false if the stream reaches the end
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;
    }
246015
public function readBytes($length)
    {
        $read = $this->read($length);
        if (false !== $read) {
            $ret = array_map('ord', str_split($read, 1));

            return $ret;
        }

        return false;
    }
892159
public function stream_read($length)
    {
        assert(null !== $this->handle);

        return fread($this->handle, $length);
    }
91593
public function strSession($key, $minLength = 0, $maxLength = false, $default = false)
	{
		return $this->str($this->session($key), $minLength, $maxLength, $default);
	}
212971
private static function read($fd, $length)
    {
        $bytes = fread($fd, $length);
        if (false === $bytes) {
            return false;
        }

        return $bytes;
    }
5724
protected function _read($length = null) {
		if (!$this->connected) {
			$message = 'No connection found while reading data from socket.';
			throw new RuntimeException($message);
		}
		if ($length) {
			if (feof($this->_connection)) {
				return false;
			}
			$data = stream_get_contents($this->_connection, $length + 2);
			$meta = stream_get_meta_data($this->_connection);

			if ($meta['timed_out']) {
				$message = 'Connection timed out while reading data from socket.';
				throw new RuntimeException($message);
			}
			$packet = rtrim($data, "\r\n");
		} else {
			$packet = stream_get_line($this->_connection, 16384, "\r\n");
		}
		return $packet;
	}
272489
public static function minLength($value, $length)
    {
        return Validator::string()->length($length, null)->validate($value);
    }
762583
static public function validPassword($password, $minLength = 6, $maxLength = 18)
    {
        if (!preg_match('/^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,12}$/', $password)) {
            return false;
        }
        $length = strlen($password);
        if ($length < $minLength || $length > $maxLength) {
            return false;
        }

        return true;
    }
214880
public function read(int $length = null): string
    {
        // can not call fgets with null when not specified
        $data = null === $length ? fgets($this->resource) : fgets($this->resource, $length);
        if (false === $data) {
            // fgets() returns false on eof while feof() returned false before
            // but will now return true
            if ($this->eof()) {
                return '';
            }

            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Reading of ' . $length . ' bytes failed: timeout of '
                        . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Reading of ' . $length . ' bytes failed.'
            );
        }

        return $data;
    }
1316608
public function readBytes($length)
    {
        if (($length + $this->_needle) > $this->_streamLength) {
            require_once 'Zend/Amf/Exception.php';
            throw new Zend_Amf_Exception('Buffer underrun at needle position: ' . $this->_needle . ' while requesting length: ' . $length);
        }
        $bytes = substr($this->_stream, $this->_needle, $length);
        $this->_needle+= $length;
        return $bytes;
    }
642708
public function read($length = 8192)
    {
        if (!$this->socket || !is_resource($this->socket)) return false;

        Debug::Log(Debug::DEBUG, "socket_read({$length})");

        $string = "";
        $togo = $length;

        while (!feof($this->socket) && $togo>0) {
            $togo = $length - strlen($string);
            if($togo) $string .= fread($this->socket, $togo);
        }

        return $string;
    }
54759
public static function length(string $value, int $min, int $max):bool
    {
        $value = (string)$value;
        $length = Str::length($value);
        return $length >= $min && $length <= $max;
    }
774027
private function __validateNumeric($int, $minLength = 1, $maxLength = 0)
    {
        if (!is_numeric($int)) {
            $this->error = 'parameter is not number';
            return false;
        } else if ($maxLength > 0 && strlen($int) > $maxLength) {
            $this->error = 'parameter is too long. number:' . $int;
            return false;
        } else if (strlen($int) < $minLength) {
            $this->error = 'parameter is too short. number:' . $int;
            return false;
        }
        return true;
    }
393815
public function length($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(strlen($this->value) < $min || strlen($this->value) > $max);
    }
611962
public function length($min, $max) {
        $this->check_role = 'length';
        $this->rule = "$min,$max";
        if (is_array($this->value)) {
            $length = count($this->value);
        } elseif ($this->value instanceof File) {
            $length = filesize($this->value->path_tmp);
        } else {
            $length = mb_strlen((string)$this->value);
        }
        $result = $length < $min || $length > $max;
        $this->checkResult($result);
        return $this;
    }
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);
    }
853812
public function read($count)
    {
        $contentLength = strlen($this->data);
        if ($this->position > $contentLength || $count > $contentLength - $this->position) {
            throw new EndOfStreamException(
                sprintf(
                    'End of stream reached when trying to read %d bytes. content length=%d, position=%d',
                    $count,
                    $contentLength,
                    $this->position
                )
            );
        }

        $chunk = substr($this->data, $this->position, $count);
        if ($chunk === false) {
            $chunk = '';
        }

        $readBytes = strlen($chunk);
        $this->position += $readBytes;

        return $chunk;
    }