From 9d1678c605ee07663c15585e3bbe656df3b65e6e Mon Sep 17 00:00:00 2001 From: Nico Hoffmann Date: Sat, 18 May 2024 17:40:44 +0200 Subject: [PATCH] Fix cs --- index.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index bb46bec..16243a1 100644 --- a/index.php +++ b/index.php @@ -9,13 +9,9 @@ function csv(string $file, string $delimiter = ','): array { $lines = file($file); $lines[0] = str_replace("\xEF\xBB\xBF", '', $lines[0]); + $csv = array_map(fn ($d) => str_getcsv($d, $delimiter), $lines); - $csv = array_map(fn ($d) => str_getcsv($d, $delimiter), $lines); - - array_walk($csv, function(&$a) use ($csv) { - $a = array_combine($csv[0], $a); - }); - + array_walk($csv, fn (&$a) => $a = array_combine($csv[0], $a)); array_shift($csv); return $csv; @@ -77,8 +73,8 @@ function csv(string $file, string $delimiter = ','): array 'pattern' => 'preview', 'method' => 'GET', 'action' => function () { - $file = $this->requestQuery('file'); - $file = $this->field()->model()->file($file); + $file = $this->requestQuery('file'); + $file = $this->field()->model()->file($file); return csv($file->root(), $this->field()->delimiter()); } ]