/** * Render the rows of output in the body of the CSV. * * @param Fields $fields * @param array $rows * @param CsvCell $csvCell * @return array */ protected function renderContent(Fields $fields, array $rows, CsvCell $csvCell) { $outRows = []; $rowIndex = 0; foreach ($rows as $row) { $outRow = []; $columnIndex = 0; foreach ($fields as $field) { $outRow[] = $csvCell->getContentRenderer()->render($field, $row, $rowIndex, $columnIndex); $columnIndex += 1; } $outRows[] = $outRow; $rowIndex += 1; } return $outRows; }
public function testUsage() { $this->assertInstanceOf('\\Dewdrop\\Fields\\Helper\\CsvCell\\Content', $this->csvCellFieldsHelper->getContentRenderer()); $this->assertInstanceOf('\\Dewdrop\\Fields\\Helper\\CsvCell\\Header', $this->csvCellFieldsHelper->getHeaderRenderer()); }