TASK: Simplfy “features" iterator
This commit is contained in:
parent
cecfe983e0
commit
7398caa099
1 changed files with 5 additions and 11 deletions
|
@ -28,12 +28,6 @@ use Typo3Update\Options;
|
||||||
*/
|
*/
|
||||||
class Features implements \Iterator
|
class Features implements \Iterator
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Internal array position for \Iterator implementation.
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected $index = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal array
|
* Internal array
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -73,22 +67,22 @@ class Features implements \Iterator
|
||||||
// implement Iterator interface:
|
// implement Iterator interface:
|
||||||
public function current()
|
public function current()
|
||||||
{
|
{
|
||||||
return $this->features[$this->index];
|
return current($this->features);
|
||||||
}
|
}
|
||||||
public function key()
|
public function key()
|
||||||
{
|
{
|
||||||
return $this->index;
|
return key($this->features);
|
||||||
}
|
}
|
||||||
public function next()
|
public function next()
|
||||||
{
|
{
|
||||||
++$this->index;
|
next($this->features);
|
||||||
}
|
}
|
||||||
public function rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
$this->index = 0;
|
reset($this->features);
|
||||||
}
|
}
|
||||||
public function valid()
|
public function valid()
|
||||||
{
|
{
|
||||||
return isset($this->features[$this->index]);
|
return current($this->features) !== false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue