annotate vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2 namespace GuzzleHttp\Cookie;
Chris@0 3
Chris@0 4 use Psr\Http\Message\RequestInterface;
Chris@0 5 use Psr\Http\Message\ResponseInterface;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Stores HTTP cookies.
Chris@0 9 *
Chris@0 10 * It extracts cookies from HTTP requests, and returns them in HTTP responses.
Chris@0 11 * CookieJarInterface instances automatically expire contained cookies when
Chris@0 12 * necessary. Subclasses are also responsible for storing and retrieving
Chris@0 13 * cookies from a file, database, etc.
Chris@0 14 *
Chris@0 15 * @link http://docs.python.org/2/library/cookielib.html Inspiration
Chris@0 16 */
Chris@0 17 interface CookieJarInterface extends \Countable, \IteratorAggregate
Chris@0 18 {
Chris@0 19 /**
Chris@0 20 * Create a request with added cookie headers.
Chris@0 21 *
Chris@0 22 * If no matching cookies are found in the cookie jar, then no Cookie
Chris@0 23 * header is added to the request and the same request is returned.
Chris@0 24 *
Chris@0 25 * @param RequestInterface $request Request object to modify.
Chris@0 26 *
Chris@0 27 * @return RequestInterface returns the modified request.
Chris@0 28 */
Chris@0 29 public function withCookieHeader(RequestInterface $request);
Chris@0 30
Chris@0 31 /**
Chris@0 32 * Extract cookies from an HTTP response and store them in the CookieJar.
Chris@0 33 *
Chris@0 34 * @param RequestInterface $request Request that was sent
Chris@0 35 * @param ResponseInterface $response Response that was received
Chris@0 36 */
Chris@0 37 public function extractCookies(
Chris@0 38 RequestInterface $request,
Chris@0 39 ResponseInterface $response
Chris@0 40 );
Chris@0 41
Chris@0 42 /**
Chris@0 43 * Sets a cookie in the cookie jar.
Chris@0 44 *
Chris@0 45 * @param SetCookie $cookie Cookie to set.
Chris@0 46 *
Chris@0 47 * @return bool Returns true on success or false on failure
Chris@0 48 */
Chris@0 49 public function setCookie(SetCookie $cookie);
Chris@0 50
Chris@0 51 /**
Chris@0 52 * Remove cookies currently held in the cookie jar.
Chris@0 53 *
Chris@0 54 * Invoking this method without arguments will empty the whole cookie jar.
Chris@0 55 * If given a $domain argument only cookies belonging to that domain will
Chris@0 56 * be removed. If given a $domain and $path argument, cookies belonging to
Chris@0 57 * the specified path within that domain are removed. If given all three
Chris@0 58 * arguments, then the cookie with the specified name, path and domain is
Chris@0 59 * removed.
Chris@0 60 *
Chris@0 61 * @param string $domain Clears cookies matching a domain
Chris@0 62 * @param string $path Clears cookies matching a domain and path
Chris@0 63 * @param string $name Clears cookies matching a domain, path, and name
Chris@0 64 *
Chris@0 65 * @return CookieJarInterface
Chris@0 66 */
Chris@0 67 public function clear($domain = null, $path = null, $name = null);
Chris@0 68
Chris@0 69 /**
Chris@0 70 * Discard all sessions cookies.
Chris@0 71 *
Chris@0 72 * Removes cookies that don't have an expire field or a have a discard
Chris@0 73 * field set to true. To be called when the user agent shuts down according
Chris@0 74 * to RFC 2965.
Chris@0 75 */
Chris@0 76 public function clearSessionCookies();
Chris@0 77
Chris@0 78 /**
Chris@0 79 * Converts the cookie jar to an array.
Chris@0 80 *
Chris@0 81 * @return array
Chris@0 82 */
Chris@0 83 public function toArray();
Chris@0 84 }