Skip to content

Commit

Permalink
Refactored code for avoiding copy/paste
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Idolov authored May 3, 2018
1 parent 68e0878 commit 9e01479
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lib/internal/Magento/Framework/File/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,23 @@ public function getDataPairs($file, $keyIndex = 0, $valueIndex = 1)
/**
* Saving data row array into file
*
* @param string $file
* @param array $data
* @return $this
* @param string $file
* @param array $data
* @return $this
* @throws \Magento\Framework\Exception\FileSystemException
* @deprecated
* @see appendData
*/
public function saveData($file, $data)
{
$fh = fopen($file, 'w');
foreach ($data as $dataRow) {
$this->file->filePutCsv($fh, $dataRow, $this->_delimiter, $this->_enclosure);
}
fclose($fh);
return $this;
return $this->appendData($file, $data, 'w');
}

/**
* Replace the saveData method by
* allowing to select the input mode
* Replace the saveData method by allowing to select the input mode
*
* @param $file
* @param $data
* @param string $file
* @param array $data
* @param string $mode
*
* @return $this
Expand Down

0 comments on commit 9e01479

Please sign in to comment.