1 | <?php |
||
10 | final class CookieJar implements \Countable, \IteratorAggregate |
||
11 | { |
||
12 | /** |
||
13 | * @var \SplObjectStorage |
||
14 | */ |
||
15 | protected $cookies; |
||
16 | |||
17 | 14 | public function __construct() |
|
21 | |||
22 | /** |
||
23 | * Checks if there is a cookie. |
||
24 | * |
||
25 | * @param Cookie $cookie |
||
26 | * |
||
27 | * @return bool |
||
28 | */ |
||
29 | 12 | public function hasCookie(Cookie $cookie) |
|
33 | |||
34 | /** |
||
35 | * Adds a cookie. |
||
36 | * |
||
37 | * @param Cookie $cookie |
||
38 | */ |
||
39 | 12 | public function addCookie(Cookie $cookie) |
|
57 | |||
58 | /** |
||
59 | * Removes a cookie. |
||
60 | * |
||
61 | * @param Cookie $cookie |
||
62 | */ |
||
63 | 6 | public function removeCookie(Cookie $cookie) |
|
67 | |||
68 | /** |
||
69 | * Returns the cookies. |
||
70 | * |
||
71 | * @return Cookie[] |
||
72 | */ |
||
73 | 1 | public function getCookies() |
|
81 | |||
82 | /** |
||
83 | * Returns all matching cookies. |
||
84 | * |
||
85 | * @param Cookie $cookie |
||
86 | * |
||
87 | * @return Cookie[] |
||
88 | */ |
||
89 | 12 | public function getMatchingCookies(Cookie $cookie) |
|
97 | |||
98 | /** |
||
99 | * Finds matching cookies based on a callable. |
||
100 | * |
||
101 | * @param callable $match |
||
102 | * |
||
103 | * @return Cookie[] |
||
104 | */ |
||
105 | 12 | protected function findMatchingCookies(callable $match) |
|
117 | |||
118 | /** |
||
119 | * Checks if there are cookies. |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | 6 | public function hasCookies() |
|
127 | |||
128 | /** |
||
129 | * Sets the cookies and removes any previous one. |
||
130 | * |
||
131 | * @param Cookie[] $cookies |
||
132 | */ |
||
133 | 1 | public function setCookies(array $cookies) |
|
138 | |||
139 | /** |
||
140 | * Adds some cookies. |
||
141 | * |
||
142 | * @param Cookie[] $cookies |
||
143 | */ |
||
144 | 5 | public function addCookies(array $cookies) |
|
150 | |||
151 | /** |
||
152 | * Removes some cookies. |
||
153 | * |
||
154 | * @param Cookie[] $cookies |
||
155 | */ |
||
156 | 2 | public function removeCookies(array $cookies) |
|
162 | |||
163 | /** |
||
164 | * Removes cookies which match the given parameters. |
||
165 | * |
||
166 | * Null means that parameter should not be matched |
||
167 | * |
||
168 | * @param string|null $name |
||
169 | * @param string|null $domain |
||
170 | * @param string|null $path |
||
171 | */ |
||
172 | public function removeMatchingCookies($name = null, $domain = null, $path = null) |
||
196 | |||
197 | /** |
||
198 | * Removes all cookies. |
||
199 | */ |
||
200 | 2 | public function clear() |
|
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | 5 | public function count() |
|
212 | |||
213 | /** |
||
214 | * {@inheritdoc} |
||
215 | */ |
||
216 | 1 | public function getIterator() |
|
220 | } |
||
221 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.