summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Bakame/Csv/Writer.php8
-rw-r--r--test/Bakame/Csv/ReaderTest.php2
-rw-r--r--test/Bakame/Csv/WriterTest.php14
3 files changed, 12 insertions, 12 deletions
diff --git a/src/Bakame/Csv/Writer.php b/src/Bakame/Csv/Writer.php
index 3d4c7b3..5127374 100644
--- a/src/Bakame/Csv/Writer.php
+++ b/src/Bakame/Csv/Writer.php
@@ -52,13 +52,13 @@ class Writer extends Csv
/**
* Add a new CSV row to the generated CSV
*
- * @param string|array|object $row the line to be added to the CSV
+ * @param mixed|object $row the line to be added to the CSV
*
* @return integer
*
* @throws InvalidArgumentException If the given row format is invalid
*/
- public function append($row)
+ public function insert($row)
{
if (self::isValidString($row)) {
$row = str_getcsv((string) $row, $this->delimiter, $this->enclosure, $this->escape);
@@ -90,7 +90,7 @@ class Writer extends Csv
*
* @throws InvalidArgumentException If the given rows format is invalid
*/
- public function save($rows)
+ public function insertMany($rows)
{
if (! is_array($rows) && ! $rows instanceof Traversable) {
throw new InvalidArgumentException(
@@ -99,7 +99,7 @@ class Writer extends Csv
}
foreach ($rows as $row) {
- $this->append($row);
+ $this->insert($row);
}
return $this;
diff --git a/test/Bakame/Csv/ReaderTest.php b/test/Bakame/Csv/ReaderTest.php
index 75e643d..fd2d9bc 100644
--- a/test/Bakame/Csv/ReaderTest.php
+++ b/test/Bakame/Csv/ReaderTest.php
@@ -220,7 +220,7 @@ class ReaderTest extends PHPUnit_Framework_TestCase
public function testGetWriter()
{
$writer = $this->csv->getWriter();
- $writer->append(['toto', 'le', 'herisson']);
+ $writer->insert(['toto', 'le', 'herisson']);
$expected = <<<EOF
<table class="table-csv-data">
<tr>
diff --git a/test/Bakame/Csv/WriterTest.php b/test/Bakame/Csv/WriterTest.php
index eeb4000..ef4c845 100644
--- a/test/Bakame/Csv/WriterTest.php
+++ b/test/Bakame/Csv/WriterTest.php
@@ -23,7 +23,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
'john,doe,john.doe@example.com',
];
foreach ($expected as $row) {
- $this->csv->append($row);
+ $this->csv->insert($row);
}
foreach ($this->csv as $row) {
@@ -36,7 +36,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
*/
public function testFailedAppendWithWrongData()
{
- $this->csv->append(new \DateTime);
+ $this->csv->insert(new \DateTime);
}
/**
@@ -44,7 +44,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
*/
public function testFailedAppendWithMultiDimensionArray()
{
- $this->csv->append(['john', new \DateTime]);
+ $this->csv->insert(['john', new \DateTime]);
}
public function testSave()
@@ -53,8 +53,8 @@ class WriterTest extends PHPUnit_Framework_TestCase
['john', 'doe', 'john.doe@example.com'],
'jane,doe,jane.doe@example.com',
];
- $this->csv->save($multipleArray);
- $this->csv->save(new ArrayIterator($multipleArray));
+ $this->csv->insertMany($multipleArray);
+ $this->csv->insertMany(new ArrayIterator($multipleArray));
foreach ($this->csv as $key => $row) {
$expected = ['jane', 'doe', 'jane.doe@example.com'];
if ($key%2 == 0) {
@@ -69,7 +69,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
*/
public function testFailedSaveWithWrongType()
{
- $this->csv->save(new \DateTime);
+ $this->csv->insertMany(new \DateTime);
}
public function testGetReader()
@@ -79,7 +79,7 @@ class WriterTest extends PHPUnit_Framework_TestCase
'john,doe,john.doe@example.com',
];
foreach ($expected as $row) {
- $this->csv->append($row);
+ $this->csv->insert($row);
}
$reader = $this->csv->getReader();