Beispiel #1
0
 public function fetch()
 {
     $options = $this->getOptionManager()->getOptions();
     if ($this->reporter) {
         $this->reporter->setFetchedLines(++$this->line);
     }
     return fgetcsv($this->handler, $options['length'], $options['delimiter'], $options['enclosure'], $options['escape']);
 }
Beispiel #2
0
 public function fetch()
 {
     $returnValue = false;
     if ($this->currentRow < $this->nbRow) {
         $returnValue = array();
         for ($c = 1; $c <= $this->nbCol; $c++) {
             $returnValue[$c - 1] = utf8_encode($this->handler->val($this->currentRow, $c));
         }
         if ($this->reporter) {
             $this->reporter->setFetchedLines($this->currentRow);
         }
         $this->currentRow++;
     }
     return $returnValue;
 }
Beispiel #3
0
 public function fetch($raw = false)
 {
     $options = $this->getOptions();
     $returnValue = false;
     if ($this->handler->valid()) {
         $returnValue = $this->handler->current();
         $this->handler->next();
         if ($options['firstline_as_keys'] && !$raw) {
             $nbValue = count($returnValue);
             $nbKeys = count($this->keys);
             if ($nbValue < $nbKeys) {
                 for ($i = $nbValue; $i < $nbKeys; $i++) {
                     $returnValue[$i] = "";
                 }
             } elseif ($nbValue > $nbKeys) {
                 throw new \Exception('Missing column names');
             }
             $returnValue = array_combine($this->keys, $returnValue);
         }
         if ($this->reporter) {
             $this->reporter->setFetchedLines(++$this->line);
         }
     }
     return $returnValue;
 }