public function retrieveNextCsvRow()
 {
     $nextLine = IterUtil::getCurrentAndAdvance($this->lines, array('default' => false));
     if ($nextLine === false) {
         return false;
     }
     $rows = str_getcsv($nextLine, $this->options['delimiter'], $this->options['enclosure'], $this->options['escape']);
     return count($rows) == 0 ? false : $rows;
 }
Beispiel #2
0
 /** @test */
 public function testGetCurrentAndAdvanceForIteratorShouldNotThrowErrorWHenProvidedWithDefault()
 {
     $a = new ArrayIterator(range(0, 1));
     $a->rewind();
     $a->next();
     $this->assertEquals(1, $a->current());
     $a->next();
     $c = IterUtil::getCurrentAndAdvance($a, array('default' => 'default-value'));
     $this->assertEquals($c, 'default-value');
 }