protected function restoreResponse($response, $data)
    {
        foreach (['format', 'protocolVersion', 'statusCode', 'reasonPhrase', 'content'] as $name) {
            $response->{$name} = $data[$name];
        }

        if (isset($data['headers'])) {
            $response->setHeaders($data['headers']);
        }

        if (isset($data['cookies']) && is_array($data['cookies'])) {
            $response->getCookies()->fromArray(array_merge($data['cookies'], $response->getCookies()->toArray()));
        }

        if (!empty($data['dynamicPlaceholders']) && is_array($data['dynamicPlaceholders'])) {
            $response->content = $this->updateDynamicContent($response->content, $data['dynamicPlaceholders'], true);
        }
        $this->afterRestoreResponse($data['cacheData'] ?? null);
    }