mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
refactor: simplify code
This commit is contained in:
@@ -419,7 +419,7 @@ class Csv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mode = FileProcessingModeEnum::getAppendMode($append);
|
$mode = FileProcessingModeEnum::getAppendMode($append);
|
||||||
$is_php = preg_match('/\.php$/i', $file) ? true : false;
|
$is_php = (bool) preg_match('/\.php$/i', $file);
|
||||||
|
|
||||||
return $this->_wfile($file, $this->unparse($data, $fields, $append, $is_php), $mode);
|
return $this->_wfile($file, $this->unparse($data, $fields, $append, $is_php), $mode);
|
||||||
}
|
}
|
||||||
@@ -855,9 +855,8 @@ class Csv {
|
|||||||
$string .= implode($delimiter, $entry) . $this->linefeed;
|
$string .= implode($delimiter, $entry) . $this->linefeed;
|
||||||
$entry = array();
|
$entry = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// create data
|
// create data
|
||||||
foreach ($data as $key => $row) {
|
foreach ($data as $row) {
|
||||||
foreach (array_keys($fieldOrder) as $index) {
|
foreach (array_keys($fieldOrder) as $index) {
|
||||||
$cell_value = $row[$index];
|
$cell_value = $row[$index];
|
||||||
$entry[] = $this->_enclose_value($cell_value, $delimiter);
|
$entry[] = $this->_enclose_value($cell_value, $delimiter);
|
||||||
|
|||||||
Reference in New Issue
Block a user