Skip to content

Commit

Permalink
Changing the CookieCollection to use IteratorAggregate
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Feb 17, 2017
1 parent a1e2fdc commit 7524716
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/Http/Cookie/CookieCollection.php
Expand Up @@ -14,13 +14,13 @@
namespace Cake\Http\Cookie;

use ArrayIterator;
use Countable;
use InvalidArgumentException;
use IteratorAggregate;

/**
* Cookie Collection
*/
class CookieCollection extends ArrayIterator implements Countable
class CookieCollection implements IteratorAggregate
{

/**
Expand All @@ -43,8 +43,6 @@ public function __construct(array $cookies = [])
$key = mb_strtolower($name);
$this->cookies[$key] = $cookie;
}

parent::__construct($this->cookies);
}

/**
Expand All @@ -69,4 +67,14 @@ protected function checkCookies(array $cookies)
}
}
}

/**
* Gets the iterator
*
* @return \ArrayIterator
*/
public function getIterator()
{
return new ArrayIterator($this->cookies);
}
}

0 comments on commit 7524716

Please sign in to comment.