public function addRow(array $row)
    {
        if (is_array($this->fields)) {
            $assoc = $row;
            $row = [];
            foreach ($this->fields as $field) {
                $row[] = isset($assoc[$field]) ? $assoc[$field] : "";
            }
        }

        $this->data[] = $row;

        return $this;
    }
public function addRow(array $row)
    {
        if (is_array($this->fields)) {
            $assoc = $row;
            $row = [];
            foreach ($this->fields as $field) {
                $row[] = isset($assoc[$field]) ? $assoc[$field] : "";
            }
        }

        $this->data[] = $row;

        return $this;
    }
public function addRow ( array $ row ) { if ( is_array ( $ this -> fields ) ) { $ assoc = $ row ; $ row = [ ] ; foreach ( $ this -> fields as $ field ) { $ row [ ] = isset ( $ assoc [ $ field ] ) ? $ assoc [ $ field ] : "" ; } } $ this -> data [ ] = $ row ; return $ this ; }
Add a row to the csv.

@param array $row Either an enumerated array or an associative array if the fields have been defined using Csv::defineFields()

@return static
Add a row to the csv .