55 if ( is_array( $iter ) ) {
56 $baseIterator =
new ArrayIterator( $iter );
57 } elseif ( $iter instanceof Iterator ) {
58 $baseIterator = $iter;
60 throw new UnexpectedValueException(
"Invalid base iterator provided." );
62 parent::__construct( $baseIterator );
64 $this->aCallback = $options[
'accept'] ??
null;
73 $this->rewound =
true;
79 $value = call_user_func( $this->vCallback, $this->getInnerIterator()->
current() );
80 $ok = (
$this->aCallback ) ? call_user_func( $this->aCallback, $value ) :
true;
82 $this->cache[
'current'] = $value;
88 public function key() {
97 return parent::valid();
102 if ( parent::valid() ) {
103 return $this->cache[
'current'];
113 if ( !$this->rewound ) {