From 145a3865821c30db4a1ce837749d7a9d5393f10d Mon Sep 17 00:00:00 2001 From: proggeler Date: Thu, 14 Dec 2023 13:13:16 +0100 Subject: [PATCH] #28: fix handling csv key-value pairs --- src/Decorators/Handler/GenericHandlerDecorator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Decorators/Handler/GenericHandlerDecorator.php b/src/Decorators/Handler/GenericHandlerDecorator.php index 2f3ffd6..07c72d2 100644 --- a/src/Decorators/Handler/GenericHandlerDecorator.php +++ b/src/Decorators/Handler/GenericHandlerDecorator.php @@ -36,7 +36,7 @@ public function decorate($currentRow): object } elseif ($type === self::TYPE_JSON) { $currentRow = json_decode($currentRow) ?? false; } elseif ($type === self::TYPE_CSV) { - $currentKeys = array_map('sprintf', array_fill_keys($currentRow, 'col%d'), range(1, count($currentRow))); + $currentKeys = array_map('sprintf', array_fill_keys(array_keys($currentRow), 'col%d'), range(1, count($currentRow))); $currentRow = new ArrayObject(array_combine($currentKeys, $currentRow), ArrayObject::ARRAY_AS_PROPS); }