From 70c81e809f9b31b628b3bbbaad17464339749d45 Mon Sep 17 00:00:00 2001
From: Pavel Zyukin
Date: Fri, 3 Jun 2016 19:09:37 +0400
Subject: [PATCH] Add the ability to pass an array with various keys to
addRows() (#240)
---
src/Spout/Writer/AbstractWriter.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Spout/Writer/AbstractWriter.php b/src/Spout/Writer/AbstractWriter.php
index effa45b..e5f9ad7 100644
--- a/src/Spout/Writer/AbstractWriter.php
+++ b/src/Spout/Writer/AbstractWriter.php
@@ -238,7 +238,8 @@ abstract class AbstractWriter implements WriterInterface
public function addRows(array $dataRows)
{
if (!empty($dataRows)) {
- if (!is_array($dataRows[0])) {
+ $firstRow = reset($dataRows);
+ if (!is_array($firstRow)) {
throw new InvalidArgumentException('The input should be an array of arrays');
}