public function setRow($index, array $row)
{
if (null === $this->nbColumns) {
$this->nbColumns = count($row);
} elseif (count($row) !== $this->nbColumns) {
throw new LogicException(sprintf('Expected the row to contain %s cells, but got %s.', $this->nbColumns, count($row)));
}
$this->rows[$index] = array_values($row);
return $this;
}