public function current() { $val = parent::current(); //if it is an array, wrap it in an iterator for convienience if (is_array($val)) { return new SelectManyLeafIterator(new Iterator_Array($val), $this->currentRaw(), $this->resultselector); } if (!$val instanceof \Iterator && !$val instanceof \IteratorAggregate) { throw new \Exception('Select Many transform function does not return iterator or array:' . get_class($val)); } else { return new SelectManyLeafIterator($val, $this->currentRaw(), $this->resultselector); } }
public function __construct($iterator, $transformer) { parent::__construct($iterator); $this->transformer = $transformer; }