Ejemplo n.º 1
0
 public function getIterator()
 {
     foreach ($this->iterator as $current) {
         Helper\LinqHelper::assertValueIsIterable($current);
         foreach ($current as $value) {
             (yield $value);
         }
     }
 }
Ejemplo n.º 2
0
 public function getIterator()
 {
     $func = $this->func;
     foreach ($this->inner as $current) {
         $accept = Helper\LinqHelper::getBoolOrThrowException($func($current));
         if ($accept) {
             (yield $current);
         }
     }
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
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)));
 }
Ejemplo n.º 5
0
 public function accept()
 {
     $func = $this->func;
     $current = $this->current();
     return Helper\LinqHelper::getBoolOrThrowException($func($current));
 }