Ejemplo n.º 1
0
 /**
  * Parse a supplied iterator
  *
  * @param Iterator $iterator
  *
  * @return Iterator
  */
 private function parseIterator(Iterator $iterator)
 {
     $iterator = $this->parseHeaderRow($iterator);
     if ($this->csvFormat->getDataStart() > 1 || $this->csvFormat->getLimit() !== -1) {
         $iterator = new LimitIterator($iterator, max(0, $this->csvFormat->getDataStart() - 1), $this->csvFormat->getLimit());
     }
     return $iterator;
 }
Ejemplo 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);
 }