/** * 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; }
/** * 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); }