| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 2 | public function pass(DataBagInterface $dataBag): DataBagInterface |
|
| 35 | { |
||
| 36 | 2 | $values = array_values(array_intersect_key($dataBag->toArray(), array_flip($this->header))); |
|
| 37 | 2 | $return = $this->file->fputcsv($values); |
|
| 38 | |||
| 39 | 2 | if ($return === false || $return === 0) { |
|
| 40 | 1 | throw new WriteErrorException( |
|
| 41 | 1 | sprintf( |
|
| 42 | 1 | 'Failed to write into file %s, data: %s.', |
|
| 43 | 1 | $this->file->getFilename(), |
|
| 44 | 1 | json_encode($values) |
|
| 45 | ) |
||
| 46 | ); |
||
| 47 | } |
||
| 48 | |||
| 49 | 1 | return $dataBag; |
|
| 50 | } |
||
| 51 | } |
||
| 52 |