Exemplo n.º 1
0
 /**
  * @param Iterator $iterator
  *
  * @return Iterator
  */
 private function parseHeaderRow(Iterator $iterator)
 {
     if ($this->csvFormat->hasHeaderRow()) {
         $iterator = new CallbackFilterIterator($iterator, [$this, 'handleHeaderRow']);
         $iterator = new MapIterator($iterator, [$this, 'mapHeaders']);
     }
     return $iterator;
 }
Exemplo n.º 2
0
 /**
  * Return an initial block if required
  *
  * @return string
  */
 public function getInitialBlock()
 {
     $linePad = $this->csvFormat->hasHeaderRow() ? $this->csvFormat->getHeaderRow() - 1 : $this->csvFormat->getDataStart() - 1;
     return $this->initial . str_repeat($this->getRowSeparator(), $linePad);
 }