public function getBodyAsStream()
    {
        $body = $this->getBody();
        if (is_callable($this->body)) {
            $body = $this->getBodyAsString();
        }
        if (is_string($body) || null === $body) {
            $stream = fopen('php://temp', 'r+');
            fwrite($stream, (string) $body);
            rewind($stream);

            return $stream;
        }

        return $body;
    }
public function getBodyAsStream()
    {
        $body = $this->getBody();
        if (is_callable($this->body)) {
            $body = $this->getBodyAsString();
        }
        if (is_string($body) || null === $body) {
            $stream = fopen('php://temp', 'r+');
            fwrite($stream, (string) $body);
            rewind($stream);

            return $stream;
        }

        return $body;
    }
public function getBodyAsStream ( ) { $ body = $ this -> getBody ( ) ; if ( is_callable ( $ this -> body ) ) { $ body = $ this -> getBodyAsString ( ) ; } if ( is_string ( $ body ) || null === $ body ) { $ stream = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ stream , ( string ) $ body ) ; rewind ( $ stream ) ; return $ stream ; } return $ body ; }
Returns the body as a readable stream resource.

Note that the stream may not be rewindable, and therefore may only be
read once.

@return resource
Returns the body as a readable stream resource .