Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function extract(InternalRequestInterface $request, ResponseInterface $response)
 {
     foreach ($response->getHeaderAsArray('Set-Cookie') as $header) {
         $cookie = $this->cookieFactory->parse($header);
         if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) {
             $cookie->setAttribute(CookieInterface::ATTR_DOMAIN, parse_url((string) $request->getUrl(), PHP_URL_HOST));
         }
         $this->addCookie($cookie);
     }
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function extract(InternalRequestInterface $request, ResponseInterface $response)
 {
     foreach ($response->getHeader('Set-Cookie') as $header) {
         $cookie = $this->cookieFactory->parse($header);
         if (!$cookie->hasAttribute(CookieInterface::ATTR_DOMAIN)) {
             $cookie->setAttribute(CookieInterface::ATTR_DOMAIN, $request->getUri()->getHost());
         }
         $this->addCookie($cookie);
     }
 }