Coseva\CSV::flushEmptyRows PHP Method

flushEmptyRows() public method

Flush rows that have turned out empty, either after applying filters or rows that simply have been empty in the source CSV from the get-go.
public flushEmptyRows ( boolean $onAfterFilter = null ) : CSV
$onAfterFilter boolean whether or not to trigger while parsing. Leave this blank to trigger a flush right now.
return CSV $this
    public function flushEmptyRows($onAfterFilter = null)
    {
        // Update the _flushOnAfterFilter flag and return.
        if (!empty($onAfterFilter)) {
            $this->_flushOnAfterFilter = (bool) $onAfterFilter;
            return $this;
        }
        // Parse the CSV.
        if (!isset($this->_rows)) {
            $this->parse();
        }
        // Walk through the rows.
        foreach ($this->_rows as $index => &$row) {
            $this->_flushEmptyRow($row, $index);
        }
        // Remove garbage.
        unset($row, $index);
        return $this;
    }