Skip to content

Commit 8359ed7

Browse files
committed
feat: get headers
1 parent dce6483 commit 8359ed7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/CsvFile.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,15 @@ public function get(): string
110110

111111
return $contents;
112112
}
113+
114+
public function getHeaders(?int $length = null): array
115+
{
116+
$headers = fgetcsv($this->stream, $length);
117+
118+
if ($headers === false) {
119+
return [];
120+
}
121+
122+
return $headers;
123+
}
113124
}

0 commit comments

Comments
 (0)