original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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.
docstring_tokens: Get the stream for the new response .