private function normalizeBody($body = null)
    {
        $body = $body ? $body : new Stream(fopen('php://temp', 'r+'));
        if (is_string($body)) {
            $memoryStream = fopen('php://temp', 'r+');
            fwrite($memoryStream, $body);
            rewind($memoryStream);
            $body = new Stream($memoryStream);
        } elseif (!($body instanceof StreamInterface)) {
            throw new InvalidArgumentException(
                'Body must be a string, null or implement Psr\Http\Message\StreamInterface'
            );
        }

        return $body;
    }
private function normalizeBody($body = null)
    {
        $body = $body ? $body : new Stream(fopen('php://temp', 'r+'));
        if (is_string($body)) {
            $memoryStream = fopen('php://temp', 'r+');
            fwrite($memoryStream, $body);
            rewind($memoryStream);
            $body = new Stream($memoryStream);
        } elseif (!($body instanceof StreamInterface)) {
            throw new InvalidArgumentException(
                'Body must be a string, null or implement Psr\Http\Message\StreamInterface'
            );
        }

        return $body;
    }
private function normalizeBody ( $ body = null ) { $ body = $ body ? $ body : new Stream ( fopen ( 'php://temp' , 'r+' ) ) ; if ( is_string ( $ body ) ) { $ memoryStream = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ memoryStream , $ body ) ; rewind ( $ memoryStream ) ; $ body = new Stream ( $ memoryStream ) ; } elseif ( ! ( $ body instanceof StreamInterface ) ) { throw new InvalidArgumentException ( 'Body must be a string, null or implement Psr\Http\Message\StreamInterface' ) ; } return $ body ; }
Normalize provided body and ensure that the result object is Stream.

@param StreamInterface|string|null $body The request body object

@return Stream Normalized body

@throws \InvalidArgumentException If an unsupported argument type is provided.
Normalize provided body and ensure that the result object is Stream .