Zend\Diactoros\MessageTrait::withBody PHP Method

withBody() public method

The body MUST be a StreamInterface object. This method MUST be implemented in such a way as to retain the immutability of the message, and MUST return a new instance that has the new body stream.
public withBody ( Psr\Http\Message\StreamInterface $body ) : static
$body Psr\Http\Message\StreamInterface Body.
return static
    public function withBody(StreamInterface $body)
    {
        $new = clone $this;
        $new->stream = $body;
        return $new;
    }