<?php
declare(strict_types=1);
namespace GuzzleHttp\Psr7;
use Psr\Http\Message\StreamInterface;
final class BufferStream implements StreamInterface
{
private $hwm;
private $buffer = '';
public function __construct(int $hwm = 16384)
{
$this->hwm = $hwm;
}
public function __toString(): string
{
return $this->getContents();
}
public function getContents(): string
{
$buffer = $this->buffer;
$this->buffer = '';