original_string: public static function toCake(PsrResponse $response)
      {
          $body = static::getBody($response);
          $data = [
              'status' => $response->getStatusCode(),
              'body' => $body['body'],
          ];
          $cake = new CakeResponse($data);
          if ($body['file']) {
              $cake->file($body['file']);
          }
          $cookies = static::parseCookies($response->getHeader('Set-Cookie'));
          foreach ($cookies as $cookie) {
              $cake->cookie($cookie);
          }
          $headers = static::collapseHeaders($response);
          $cake->header($headers);
  
          if (!empty($headers['Content-Type'])) {
              $cake->type($headers['Content-Type']);
          }
  
          return $cake;
      }
code: public static function toCake(PsrResponse $response)
      {
          $body = static::getBody($response);
          $data = [
              'status' => $response->getStatusCode(),
              'body' => $body['body'],
          ];
          $cake = new CakeResponse($data);
          if ($body['file']) {
              $cake->file($body['file']);
          }
          $cookies = static::parseCookies($response->getHeader('Set-Cookie'));
          foreach ($cookies as $cookie) {
              $cake->cookie($cookie);
          }
          $headers = static::collapseHeaders($response);
          $cake->header($headers);
  
          if (!empty($headers['Content-Type'])) {
              $cake->type($headers['Content-Type']);
          }
  
          return $cake;
      }
code_tokens: public static function toCake ( PsrResponse $ response ) { $ body = static :: getBody ( $ response ) ; $ data = [ 'status' => $ response -> getStatusCode ( ) , 'body' => $ body [ 'body' ] , ] ; $ cake = new CakeResponse ( $ data ) ; if ( $ body [ 'file' ] ) { $ cake -> file ( $ body [ 'file' ] ) ; } $ cookies = static :: parseCookies ( $ response -> getHeader ( 'Set-Cookie' ) ) ; foreach ( $ cookies as $ cookie ) { $ cake -> cookie ( $ cookie ) ; } $ headers = static :: collapseHeaders ( $ response ) ; $ cake -> header ( $ headers ) ; if ( ! empty ( $ headers [ 'Content-Type' ] ) ) { $ cake -> type ( $ headers [ 'Content-Type' ] ) ; } return $ cake ; }
docstring: Convert a PSR7 Response into a CakePHP one.
  
  @param \Psr\Http\Message\ResponseInterface $response The response to convert.
  @return \Cake\Http\Response The equivalent CakePHP response
docstring_tokens: Convert a PSR7 Response into a CakePHP one .