/** * Import response metadata (headers, cookies) from another response. * * @param AgaviResponse The other response to import information from. * * @author David Zülke <*****@*****.**> * @since 0.11.0 */ public function merge(AgaviResponse $otherResponse) { if ($otherResponse instanceof AgaviWebResponse) { foreach ($otherResponse->getHttpHeaders() as $name => $value) { if (!$this->hasHttpHeader($name)) { $this->setHttpHeader($name, $value); } } foreach ($otherResponse->getCookies() as $name => $cookie) { if (!$this->hasCookie($name)) { $this->setCookie($name, $cookie['value'], $cookie['lifetime'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']); } } if ($otherResponse->hasRedirect() && !$this->hasRedirect()) { $redirect = $otherResponse->getRedirect(); $this->setRedirect($redirect['location'], $redirect['code']); } } }