From 0638049fb2fb495ea79bf63cc457167782cb78a1 Mon Sep 17 00:00:00 2001 From: William Knauss Date: Wed, 5 Feb 2014 18:38:55 -0500 Subject: [PATCH] save readability --- parsecsv.lib.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/parsecsv.lib.php b/parsecsv.lib.php index 2b4fa27..cae764b 100644 --- a/parsecsv.lib.php +++ b/parsecsv.lib.php @@ -255,10 +255,14 @@ class parseCSV { * @param fields field names * @return true or false */ - function save ($file = null, $data = array(), $append = false, $fields = array()) { - if ( empty($file) ) $file = &$this->file; - $mode = ( $append ) ? 'at' : 'wt' ; - $is_php = ( preg_match('/\.php$/i', $file) ) ? true : false ; + public function save ($file = null, $data = array(), $append = false, $fields = array()) { + if (empty($file)) { + $file = &$this->file; + } + + $mode = ($append) ? 'at' : 'wt'; + $is_php = (preg_match('/\.php$/i', $file)) ? true : false; + return $this->_wfile($file, $this->unparse($data, $fields, $append, $is_php), $mode); }