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