1: <?php
2:
3: namespace Guzzle\Plugin\Cookie\CookieJar;
4:
5: use Guzzle\Plugin\Cookie\Cookie;
6: use Guzzle\Http\Message\RequestInterface;
7: use Guzzle\Http\Message\Response;
8:
9: /**
10: * Interface for persisting cookies
11: */
12: interface CookieJarInterface extends \Countable, \IteratorAggregate
13: {
14: /**
15: * Remove cookies currently held in the Cookie cookieJar.
16: *
17: * Invoking this method without arguments will empty the whole Cookie cookieJar. If given a $domain argument only
18: * cookies belonging to that domain will be removed. If given a $domain and $path argument, cookies belonging to
19: * the specified path within that domain are removed. If given all three arguments, then the cookie with the
20: * specified name, path and domain is removed.
21: *
22: * @param string $domain Set to clear only cookies matching a domain
23: * @param string $path Set to clear only cookies matching a domain and path
24: * @param string $name Set to clear only cookies matching a domain, path, and name
25: *
26: * @return CookieJarInterface
27: */
28: public function remove($domain = null, $path = null, $name = null);
29:
30: /**
31: * Discard all temporary cookies.
32: *
33: * Scans for all cookies in the cookieJar with either no expire field or a true discard flag. To be called when the
34: * user agent shuts down according to RFC 2965.
35: *
36: * @return CookieJarInterface
37: */
38: public function removeTemporary();
39:
40: /**
41: * Delete any expired cookies
42: *
43: * @return CookieJarInterface
44: */
45: public function removeExpired();
46:
47: /**
48: * Add a cookie to the cookie cookieJar
49: *
50: * @param Cookie $cookie Cookie to add
51: *
52: * @return bool Returns true on success or false on failure
53: */
54: public function add(Cookie $cookie);
55:
56: /**
57: * Add cookies from a {@see Guzzle\Http\Message\Response} object
58: *
59: * @param Response $response Response object
60: */
61: public function addCookiesFromResponse(Response $response);
62:
63: /**
64: * Get cookies matching a request object
65: *
66: * @param RequestInterface $request Request object to match
67: *
68: * @return array
69: */
70: public function getMatchingCookies(RequestInterface $request);
71:
72: /**
73: * Get all of the matching cookies
74: *
75: * @param string $domain Domain of the cookie
76: * @param string $path Path of the cookie
77: * @param string $name Name of the cookie
78: * @param bool $skipDiscardable Set to TRUE to skip cookies with the Discard attribute.
79: * @param bool $skipExpired Set to FALSE to include expired
80: *
81: * @return array Returns an array of Cookie objects
82: */
83: public function all($domain = null, $path = null, $name = null, $skipDiscardable = false, $skipExpired = true);
84: }
85: