src/Viserio/Component/Http/Stream/BufferStream.php
public function read($length): string
    {
        $currentLength = \strlen($this->buffer);

        if ($length >= $currentLength) {
            // No need to slice the buffer because we don't have enough data.
            $result       = $this->buffer;
            $this->buffer = '';
        } else {
            // Slice up the result to provide a subset of the buffer.
            $result       = \substr($this->buffer, 0, $length);
            $this->buffer = \substr($this->buffer, $length);
        }

        return $result;
    }
public function read($length): string
    {
        $currentLength = \strlen($this->buffer);

        if ($length >= $currentLength) {
            // No need to slice the buffer because we don't have enough data.
            $result       = $this->buffer;
            $this->buffer = '';
        } else {
            // Slice up the result to provide a subset of the buffer.
            $result       = \substr($this->buffer, 0, $length);
            $this->buffer = \substr($this->buffer, $length);
        }

        return $result;
    }
{@inheritdoc}