/** * Maintains an in-memory cache of the results yielded by the internal * iterator. * * @param array|\Traversable $items The items to be filtered. */ public function __construct($items) { $this->_buffer = new SplDoublyLinkedList(); parent::__construct($items); }
/** * Creates an iterator from another iterator that will modify each of the values * by converting them using a callback function. * * Each time the callback is executed it will receive the value of the element * in the current iteration, the key of the element and the passed $items iterator * as arguments, in that order. * * @param array|\Traversable $items The items to be filtered. * @param callable $callback Callback. */ public function __construct($items, callable $callback) { $this->_callback = $callback; parent::__construct($items); $this->_innerIterator = $this->getInnerIterator(); }