original_string: public function addFromResponse(ResponseInterface $response, RequestInterface $request)
      {
          $uri = $request->getUri();
          $host = $uri->getHost();
          $path = $uri->getPath() ?: '/';
  
          $cookies = static::parseSetCookieHeader($response->getHeader('Set-Cookie'));
          $cookies = $this->setRequestDefaults($cookies, $host, $path);
          $new = clone $this;
          foreach ($cookies as $cookie) {
              $new->cookies[$cookie->getId()] = $cookie;
          }
          $new->removeExpiredCookies($host, $path);
  
          return $new;
      }
code: public function addFromResponse(ResponseInterface $response, RequestInterface $request)
      {
          $uri = $request->getUri();
          $host = $uri->getHost();
          $path = $uri->getPath() ?: '/';
  
          $cookies = static::parseSetCookieHeader($response->getHeader('Set-Cookie'));
          $cookies = $this->setRequestDefaults($cookies, $host, $path);
          $new = clone $this;
          foreach ($cookies as $cookie) {
              $new->cookies[$cookie->getId()] = $cookie;
          }
          $new->removeExpiredCookies($host, $path);
  
          return $new;
      }
code_tokens: public function addFromResponse ( ResponseInterface $ response , RequestInterface $ request ) { $ uri = $ request -> getUri ( ) ; $ host = $ uri -> getHost ( ) ; $ path = $ uri -> getPath ( ) ? : '/' ; $ cookies = static :: parseSetCookieHeader ( $ response -> getHeader ( 'Set-Cookie' ) ) ; $ cookies = $ this -> setRequestDefaults ( $ cookies , $ host , $ path ) ; $ new = clone $ this ; foreach ( $ cookies as $ cookie ) { $ new -> cookies [ $ cookie -> getId ( ) ] = $ cookie ; } $ new -> removeExpiredCookies ( $ host , $ path ) ; return $ new ; }
docstring: Create a new collection that includes cookies from the response.
  
  @param \Psr\Http\Message\ResponseInterface $response Response to extract cookies from.
  @param \Psr\Http\Message\RequestInterface $request Request to get cookie context from.
  @return static
docstring_tokens: Create a new collection that includes cookies from the response .