Remove unnecessary class

This commit is contained in:
Meritoo
2017-10-20 00:13:43 +02:00
parent a09b0c72ae
commit 7846cedba4

View File

@@ -1,87 +0,0 @@
<?php
namespace Meritoo\Common\Iterator;
use Iterator;
/**
* Iterator of iterable values
*
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
* @copyright Meritoo.pl
*/
class CommonIterator implements Iterator
{
/**
* Index/Position of current value
*
* @var int
*/
private $currentIndex = 0;
/**
* Maximum index/position of current value
*
* @var int
*/
private $maxIndex = 0;
/**
* Values to iterate
*
* @var array
*/
private $values = [];
/**
* Class constructor
*
* @param array $values Values to iterate
*/
public function __construct(array $values)
{
$this->values = $values;
}
/**
* {@inheritdoc}
*/
public function current()
{
return $this->values[$this->currentIndex];
}
/**
* {@inheritdoc}
*/
public function key()
{
return $this->currentIndex;
}
/**
* {@inheritdoc}
*/
public function next()
{
if (0 <= $this->currentIndex && $this->maxIndex > $this->currentIndex) {
++$this->currentIndex;
}
}
/**
* {@inheritdoc}
*/
public function rewind()
{
$this->currentIndex = 0;
}
/**
* {@inheritdoc}
*/
public function valid()
{
return 0 <= $this->currentIndex && $this->maxIndex >= $this->currentIndex;
}
}