10 final class CookieJar implements \Countable, \IteratorAggregate
19 $this->cookies = new \SplObjectStorage();
31 return $this->cookies->contains($cookie);
44 foreach (
$cookies as $matchingCookie) {
45 if ($cookie->
getValue() !== $matchingCookie->getValue() || $cookie->
getMaxAge() > $matchingCookie->getMaxAge()) {
53 $this->cookies->attach($cookie);
65 $this->cookies->detach($cookie);
75 $match =
function ($matchCookie) {
91 $match =
function ($matchCookie) use ($cookie) {
92 return $matchCookie->match($cookie);
109 foreach ($this->cookies as $cookie) {
110 if ($match($cookie)) {
125 return $this->cookies->count() > 0;
174 $match =
function ($cookie) use ($name, $domain, $path) {
178 $match = $match && ($cookie->getName() === $name);
181 if (isset($domain)) {
182 $match = $match && $cookie->matchDomain($domain);
186 $match = $match && $cookie->matchPath($path);
200 public function clear()
202 $this->cookies = new \SplObjectStorage();
208 public function count()
210 return $this->cookies->count();