Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simplifying the CookieCollections
  • Loading branch information
Florian Krämer committed Feb 13, 2017
1 parent 685eb90 commit c204d46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 59 deletions.
4 changes: 3 additions & 1 deletion src/Http/Cookie/CookieCollection.php
Expand Up @@ -13,7 +13,9 @@
*/
namespace Cake\Http\Cookie;

class CookieCollection
use \ArrayIterator ;

class CookieCollection extends ArrayIterator
{
/**
* @var Cookie[]
Expand Down
60 changes: 2 additions & 58 deletions src/Http/Cookie/RequestCookies.php
Expand Up @@ -17,13 +17,13 @@
use Iterator;
use Psr\Http\Message\ServerRequestInterface;

class RequestCookies extends CookieCollection implements Iterator
class RequestCookies extends CookieCollection
{
/**
* Create instance from a server request.
*
* @param \Psr\Http\Message\ServerRequestInterface $request Request object
* @return \Cake\Http\Client\Cookie\RequestCookies
* @return \Cake\Http\Client\RequestCookies
*/
public static function createFromRequest(ServerRequestInterface $request)
{
Expand Down Expand Up @@ -66,60 +66,4 @@ public function get($name)

return $this->cookies[$key];
}

/**
* Current
*
* @return \Cake\Http\Client\Cookie\Cookie $cookie
*/
public function current()
{
return current($this->cookies);
}

/**
* Key
*
* @return string
*/
public function key()
{
$key = key($this->cookies);
if ($key === null) {
return $key;
}
$cookie = $this->cookies[$key];

return $cookie->getName();
}

/**
* Next
*
* @return void
*/
public function next()
{
next($this->cookies);
}

/**
* Valid
*
* @return bool
*/
public function valid()
{
return key($this->cookies) !== null;
}

/**
* Rewind
*
* @return void
*/
public function rewind()
{
reset($this->cookies);
}
}

0 comments on commit c204d46

Please sign in to comment.