Skip to content

Commit

Permalink
Fix cs
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed May 18, 2024
1 parent ad00a5b commit 9d1678c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
]
Expand Down

0 comments on commit 9d1678c

Please sign in to comment.