Skip to content

Commit 85925a1

Browse files
CSVParser
1 parent 5b1f359 commit 85925a1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/CSV.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ function parse($data) {
9797
//Throw error header not found
9898
throw new Exception('Error: Header not found');
9999
}
100+
} else {
101+
if($this->headerOffset == 0) {
102+
//Remove header from data
103+
array_shift($rawData);
104+
} else if(isset($rawData[$this->headerOffset])) {
105+
//Remove header from data
106+
unset($rawData[$this->headerOffset]);
107+
} else {
108+
//Throw error header not found
109+
throw new Exception('Error: Header not found');
110+
}
100111
}
101112
//Parse body data
102113
$parseData = [];

0 commit comments

Comments
 (0)