src/Viserio/Component/Http/Response/HtmlResponse.php
private function createBody($html): StreamInterface
    {
        if ($html instanceof StreamInterface) {
            return $html;
        }

        if (! \is_string($html)) {
            throw new InvalidArgumentException(\sprintf(
                'Invalid content [%s] provided to %s',
                (\is_object($html) ? \get_class($html) : \gettype($html)),
                __CLASS__
            ));
        }

        $body = new Stream(\fopen('php://temp', 'w+b'));
        $body->write($html);
        $body->rewind();

        return $body;
    }
private function createBody($html): StreamInterface
    {
        if ($html instanceof StreamInterface) {
            return $html;
        }

        if (! \is_string($html)) {
            throw new InvalidArgumentException(\sprintf(
                'Invalid content [%s] provided to %s',
                (\is_object($html) ? \get_class($html) : \gettype($html)),
                __CLASS__
            ));
        }

        $body = new Stream(\fopen('php://temp', 'w+b'));
        $body->write($html);
        $body->rewind();

        return $body;
    }
Create the message body.

@param \Psr\Http\Message\StreamInterface|string $html

@throws \Viserio\Component\Contract\Http\Exception\InvalidArgumentException if $html is neither a string or stream

@return \Psr\Http\Message\StreamInterface