lib/Request.php
public function withBody($body): self {
        $clone = clone $this;

        if ($body === null) {
            $clone->body = new StringBody("");
        } elseif (\is_scalar($body)) {
            $clone->body = new StringBody((string) $body);
        } elseif ($body instanceof RequestBody) {
            $clone->body = $body;
        } else {
            throw new \TypeError("Invalid body type: " . gettype($body));
        }

        return $clone;
    }
public function withBody($body): self {
        $clone = clone $this;

        if ($body === null) {
            $clone->body = new StringBody("");
        } elseif (\is_scalar($body)) {
            $clone->body = new StringBody((string) $body);
        } elseif ($body instanceof RequestBody) {
            $clone->body = $body;
        } else {
            throw new \TypeError("Invalid body type: " . gettype($body));
        }

        return $clone;
    }
public function withBody ( $ body ) : self { $ clone = clone $ this ; if ( $ body === null ) { $ clone -> body = new StringBody ( "" ) ; } elseif ( \ is_scalar ( $ body ) ) { $ clone -> body = new StringBody ( ( string ) $ body ) ; } elseif ( $ body instanceof RequestBody ) { $ clone -> body = $ body ; } else { throw new \ TypeError ( "Invalid body type: " . gettype ( $ body ) ) ; } return $ clone ; }
Assign the message entity body.

@param mixed $body

@return Request
Assign the message entity body .