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;
    }