public function getIterator() { foreach ($this->iterator as $current) { Helper\LinqHelper::assertValueIsIterable($current); foreach ($current as $value) { (yield $value); } } }
public function getIterator() { $func = $this->func; foreach ($this->inner as $current) { $accept = Helper\LinqHelper::getBoolOrThrowException($func($current)); if ($accept) { (yield $current); } } }
public function rewind() { $this->iterator->rewind(); if ($this->iterator->valid()) { $current = $this->iterator->current(); $this->currentIterator = Helper\LinqHelper::getIteratorOrThrow($current); if ($this->currentIterator != null) { $this->currentIterator->rewind(); } } else { $this->currentIterator = null; } $this->key = 0; }
/** * Returns all elements except the ones of the given sequence. * * @param array|\Iterator $second * @return Linq Returns all items of this not occuring in $second */ public function except($second) { LinqHelper::assertArgumentIsIterable($second, "second"); return new Linq(new ExceptIterator($this->iterator, LinqHelper::getIteratorOrThrow($second))); }
public function accept() { $func = $this->func; $current = $this->current(); return Helper\LinqHelper::getBoolOrThrowException($func($current)); }