From aeafe316d07c73274633a10950ea8565f00c4d18 Mon Sep 17 00:00:00 2001
From: glukkkk
Date: Fri, 3 Jun 2016 18:43:49 +0400
Subject: [PATCH] Add the ability to pass an array with various keys to
addRows()
---
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');
}