File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -158,16 +158,13 @@ public function parse()
158
158
while (($ line = fgets ($ file )) !== false ) {
159
159
$ lineNumber ++;
160
160
161
+ // change encoding
162
+ if ($ this ->fromEncoding !== null && $ this ->toEncoding !== null ) {
163
+ $ line = iconv ($ this ->fromEncoding , $ this ->toEncoding , $ line );
164
+ }
165
+
161
166
if ($ this ->delimiter !== null ) {
162
167
$ line = str_getcsv ($ line , $ this ->delimiter , $ this ->enclosure , $ this ->escape );
163
- // change encoding
164
- if ($ this ->fromEncoding !== null && $ this ->toEncoding !== null ) {
165
- $ line = array_map (function ($ val ) {
166
- return iconv ($ this ->fromEncoding , $ this ->toEncoding , $ val );
167
- }, $ line );
168
- }
169
- } else {
170
- $ line = iconv ($ this ->fromEncoding , $ this ->toEncoding , $ line );
171
168
}
172
169
173
170
// transform lines to object?
@@ -178,7 +175,7 @@ public function parse()
178
175
// execute callable for each line
179
176
if (is_callable ($ this ->each )) {
180
177
$ func = $ this ->each ;
181
- $ line = $ func ($ line );
178
+ $ line = $ func ($ line, $ lineNumber );
182
179
}
183
180
184
181
// execute callable to filter line
You can’t perform that action at this time.
0 commit comments