summaryrefslogtreecommitdiffstats
path: root/src/Writer.php
diff options
context:
space:
mode:
authorIgnace Nyamagana Butera <nyamsprod@gmail.com>2015-03-02 09:01:08 +0100
committerIgnace Nyamagana Butera <nyamsprod@gmail.com>2015-03-02 09:01:08 +0100
commit865d138a7a7895b62af9e5aaa7ca1644a19241de (patch)
tree759725f02bbec063a217d3e7dd164a17ab2ce86f /src/Writer.php
parent97b66b0e0412129b4585d50fb15e86fc88a9ae6f (diff)
downloadcsv-865d138a7a7895b62af9e5aaa7ca1644a19241de.zip
csv-865d138a7a7895b62af9e5aaa7ca1644a19241de.tar.gz
csv-865d138a7a7895b62af9e5aaa7ca1644a19241de.tar.bz2
remove getCsv from Writer
Diffstat (limited to 'src/Writer.php')
-rw-r--r--src/Writer.php26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/Writer.php b/src/Writer.php
index f835bd6..84b5c8d 100644
--- a/src/Writer.php
+++ b/src/Writer.php
@@ -82,30 +82,16 @@ class Writer extends AbstractCsv
}
$row = $this->formatRow($row);
$this->validateRow($row);
- $csv = $this->getCsv();
- $csv->fputcsv($row, $this->delimiter, $this->enclosure);
- if ("\n" !== $this->newline) {
- $csv->fseek(-1, SEEK_CUR);
- $csv->fwrite($this->newline);
- }
-
- return $this;
- }
-
- /**
- * Sets the csv container as a \SplFileObject instance
- * and Insures we use the same object for insertion to
- * avoid loosing the cursor position
- *
- * @return \SplFileObject
- */
- protected function getCsv()
- {
if (is_null($this->csv)) {
$this->csv = $this->getIterator();
}
+ $this->csv->fputcsv($row, $this->delimiter, $this->enclosure);
+ if ("\n" !== $this->newline) {
+ $this->csv->fseek(-1, SEEK_CUR);
+ $this->csv->fwrite($this->newline);
+ }
- return $this->csv;
+ return $this;
}
/**