| Conditions | 5 |
| Paths | 8 |
| Total Lines | 27 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 2 |
| 1 | <?php |
||
| 29 | public function __construct(SplFileObject $fileObject, array $options = []) |
||
| 30 | { |
||
| 31 | $resolver = new OptionsResolver(); |
||
| 32 | $resolver->setDefaults([ |
||
| 33 | 'delimiter' => ',', |
||
| 34 | 'enclosure' => '"', |
||
| 35 | 'header' => true, |
||
| 36 | ]); |
||
| 37 | |||
| 38 | $this->options = $resolver->resolve($options); |
||
| 39 | |||
| 40 | $this->fileObject = $fileObject; |
||
| 41 | |||
| 42 | $headers = []; |
||
| 43 | if ($this->options['header']) { |
||
| 44 | $headers = $this->readCurrentRow(); |
||
| 45 | } |
||
| 46 | |||
| 47 | while (($data = $this->readCurrentRow()) != false) { |
||
| 48 | //skip empty rows |
||
| 49 | if($data == [null]){ |
||
| 50 | continue; |
||
| 51 | } |
||
| 52 | if ($headers) { |
||
| 53 | $this->addItem(array_combine($headers, $data)); |
||
|
|
|||
| 54 | } else { |
||
| 55 | $this->addItem($data); |
||
| 56 | } |
||
| 65 |