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);
    }
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);
    }
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 ) ; }
Restores response properties from the given data.
@param Response $response the response to be restored.
@param array $data the response property data.
@since 2.0.3
Restores response properties from the given data .