/** * @param EnlightResponse $response * @return SymfonyResponse */ public function transformEnlightResponseToSymfonyResponse(EnlightResponse $response) { $rawHeaders = $response->getHeaders(); $headers = array(); foreach ($rawHeaders as $header) { if (!isset($headers[$header['name']]) || !empty($header['replace'])) { header_remove($header['name']); $headers[$header['name']] = array($header['value']); } else { $headers[$header['name']][] = $header['value']; } } $symfonyResponse = new SymfonyResponse($response->getBody(), $response->getHttpResponseCode(), $headers); foreach ($response->getCookies() as $cookieName => $cookieContent) { $sfCookie = new Cookie($cookieName, $cookieContent['value'], $cookieContent['expire'], $cookieContent['path'], $cookieContent['domain'], (bool) $cookieContent['secure'], (bool) $cookieContent['httpOnly']); $symfonyResponse->headers->setCookie($sfCookie); } return $symfonyResponse; }