| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 2.2559 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | public function write(array $fields) |
|
| 34 | { |
||
| 35 | 1 | $options = $this->getCsvControl(); |
|
| 36 | 1 | $delimiter = $options[0]; |
|
| 37 | 1 | $enclosure = $options[1]; |
|
| 38 | 1 | if (!empty($enclosure)) { |
|
| 39 | 1 | return $this->fputcsv($fields, $delimiter, $enclosure); |
|
| 40 | } |
||
| 41 | |||
| 42 | $fields = array_map(function ($field) use ($delimiter, $enclosure) { |
||
| 43 | return str_replace([$delimiter, PHP_EOL, chr(10)], ['', '', ''], $field); |
||
| 44 | }, $fields); |
||
| 45 | |||
| 46 | return $this->fwrite(implode($delimiter, $fields) . chr(10)); |
||
| 47 | } |
||
| 48 | } |
||
| 49 |