public function withBody(StreamInterface $body)
    {
        if (false) {
            // Body is forced to a StreamInterface in parameters.
            // How can it be invalid ?
            throw new InvalidArgumentException('Body is not valid.');
        }
        $message = clone $this;
        $message->stream = $body;

        return $message;
    }
public function withBody(StreamInterface $body)
    {
        if (false) {
            // Body is forced to a StreamInterface in parameters.
            // How can it be invalid ?
            throw new InvalidArgumentException('Body is not valid.');
        }
        $message = clone $this;
        $message->stream = $body;

        return $message;
    }
public function withBody ( StreamInterface $ body ) { if ( false ) { // Body is forced to a StreamInterface in parameters. // How can it be invalid ? throw new InvalidArgumentException ( 'Body is not valid.' ) ; } $ message = clone $ this ; $ message -> stream = $ body ; return $ message ; }
Return an instance with the specified message body.
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.

@param StreamInterface $body Body.
@return MessageInterface
@throws \InvalidArgumentException When the body is not valid.
Return an instance with the specified message body . 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 .