src/http/MessageTrait.php
public function withBody(StreamInterface $body)
    {
        if ($this->getBody() === $body) {
            return $this;
        }

        $newInstance = clone $this;
        $newInstance->setBody($body);
        return $newInstance;
    }
public function withBody(StreamInterface $body)
    {
        if ($this->getBody() === $body) {
            return $this;
        }

        $newInstance = clone $this;
        $newInstance->setBody($body);
        return $newInstance;
    }
public function withBody ( StreamInterface $ body ) { if ( $ this -> getBody ( ) === $ body ) { return $ this ; } $ newInstance = clone $ this ; $ newInstance -> setBody ( $ body ) ; return $ newInstance ; }
Return an instance with the specified message body.
This method retains the immutability of the message and returns an instance that has the
new body stream.
@param StreamInterface $body Body.
@return static
@throws \InvalidArgumentException When the body is not valid.
Return an instance with the specified message body . This method retains the immutability of the message and returns an instance that has the new body stream .