final public function buffer(): Promise
    {
        if ($this->promise) {
            return $this->promise;
        }

        return $this->promise = call(function () {
            $buffer = '';
            if ($this->lastRead && null === yield $this->lastRead) {
                return $buffer;
            }

            while (null !== $chunk = yield $this->stream->read()) {
                $buffer .= $chunk;
            }
            return $buffer;
        });
    }
final public function buffer(): Promise
    {
        if ($this->promise) {
            return $this->promise;
        }

        return $this->promise = call(function () {
            $buffer = '';
            if ($this->lastRead && null === yield $this->lastRead) {
                return $buffer;
            }

            while (null !== $chunk = yield $this->stream->read()) {
                $buffer .= $chunk;
            }
            return $buffer;
        });
    }
final public function buffer ( ) : Promise { if ( $ this -> promise ) { return $ this -> promise ; } return $ this -> promise = call ( function ( ) { $ buffer = '' ; if ( $ this -> lastRead && null === yield $ this -> lastRead ) { return $ buffer ; } while ( null !== $ chunk = yield $ this -> stream -> read ( ) ) { $ buffer .= $ chunk ; } return $ buffer ; } ) ; }
Buffers the entire message and resolves the returned promise then.

@return Promise<string> Resolves with the entire message contents.
Buffers the entire message and resolves the returned promise then .