protected static function getStream($response)
    {
        $stream = 'php://memory';
        $body = $response->body();
        if (is_string($body) && strlen($body)) {
            $stream = new Stream('php://memory', 'wb');
            $stream->write($body);

            return $stream;
        }
        if (is_callable($body)) {
            $stream = new CallbackStream($body);

            return $stream;
        }
        $file = $response->getFile();
        if ($file) {
            $stream = new Stream($file->path, 'rb');

            return $stream;
        }

        return $stream;
    }
protected static function getStream($response)
    {
        $stream = 'php://memory';
        $body = $response->body();
        if (is_string($body) && strlen($body)) {
            $stream = new Stream('php://memory', 'wb');
            $stream->write($body);

            return $stream;
        }
        if (is_callable($body)) {
            $stream = new CallbackStream($body);

            return $stream;
        }
        $file = $response->getFile();
        if ($file) {
            $stream = new Stream($file->path, 'rb');

            return $stream;
        }

        return $stream;
    }
protected static function getStream ( $ response ) { $ stream = 'php://memory' ; $ body = $ response -> body ( ) ; if ( is_string ( $ body ) && strlen ( $ body ) ) { $ stream = new Stream ( 'php://memory' , 'wb' ) ; $ stream -> write ( $ body ) ; return $ stream ; } if ( is_callable ( $ body ) ) { $ stream = new CallbackStream ( $ body ) ; return $ stream ; } $ file = $ response -> getFile ( ) ; if ( $ file ) { $ stream = new Stream ( $ file -> path , 'rb' ) ; return $ stream ; } return $ stream ; }
Get the stream for the new response.

@param \Cake\Http\Response $response The cake response to extract the body from.
@return \Psr\Http\Message\StreamInterface|string The stream.
Get the stream for the new response .