Box\Spout\Writer\AbstractWriter::addRow PHP Method

addRow() public method

Write given data to the output. New data will be appended to end of stream.
public addRow ( array $dataRow ) : AbstractWriter
$dataRow array Array containing data to be streamed. If empty, no data is added (i.e. not even as a blank row) Example: $dataRow = ['data1', 1234, null, '', 'data5', false];
return AbstractWriter
    public function addRow(array $dataRow)
    {
        if ($this->isWriterOpened) {
            // empty $dataRow should not add an empty line
            if (!empty($dataRow)) {
                try {
                    $this->addRowToWriter($dataRow, $this->rowStyle);
                } catch (SpoutException $e) {
                    // if an exception occurs while writing data,
                    // close the writer and remove all files created so far.
                    $this->closeAndAttemptToCleanupAllFiles();
                    // re-throw the exception to alert developers of the error
                    throw $e;
                }
            }
        } else {
            throw new WriterNotOpenedException('The writer needs to be opened before adding row.');
        }
        return $this;
    }