for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Indigo\Iterator;
/**
* Pass callbacks as iterator methods.
*
* @author Márk Sági-Kazár <[email protected]>
*/
class CallbackIterator implements \Iterator
{
* @var callable
protected $current;
protected $next;
protected $key;
protected $valid;
protected $rewind;
* @param callable $current
* @param callable $next
* @param callable $key
* @param callable $valid
* @param callable $rewind
public function __construct(
callable $current,
callable $next,
callable $key,
callable $valid,
callable $rewind
) {
$this->current = $current;
$this->next = $next;
$this->key = $key;
$this->valid = $valid;
$this->rewind = $rewind;
}
* {@inheritdoc}
public function current()
return call_user_func($this->current);
public function next()
call_user_func($this->next);
public function key()
return call_user_func($this->key);
public function valid()
return call_user_func($this->valid);
public function rewind()
call_user_func($this->rewind);