Skip to content

Commit b9732d7

Browse files
committed
Added possibility to select PHP input file mode
1 parent 055a79b commit b9732d7

File tree

1 file changed

+9
-5
lines changed
  • lib/internal/Magento/Framework/File

1 file changed

+9
-5
lines changed

lib/internal/Magento/Framework/File/Csv.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,17 @@ public function getDataPairs($file, $keyIndex = 0, $valueIndex = 1)
126126
/**
127127
* Saving data row array into file
128128
*
129-
* @param string $file
130-
* @param array $data
131-
* @return $this
129+
* @param string $file
130+
* @param array $data
131+
* @param string $mode
132+
*
133+
* @return $this
134+
*
135+
* @throws \Magento\Framework\Exception\FileSystemException
132136
*/
133-
public function saveData($file, $data)
137+
public function saveData($file, $data, $mode = 'w')
134138
{
135-
$fh = fopen($file, 'w');
139+
$fh = fopen($file, $mode);
136140
foreach ($data as $dataRow) {
137141
$this->file->filePutCsv($fh, $dataRow, $this->_delimiter, $this->_enclosure);
138142
}

0 commit comments

Comments
 (0)