| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 3 | public function write(SpreadsheetInterface $spreadsheet): FileInterface |
|
| 35 | { |
||
| 36 | $directory = $spreadsheet |
||
| 37 | 3 | ->sheets() |
|
| 38 | 3 | ->reduce( |
|
| 39 | 3 | new Directory($spreadsheet->name()), |
|
| 40 | function(Directory $carry, string $name, SheetInterface $sheet): Directory { |
||
| 41 | 3 | return $carry->add($this->buildFile($sheet)); |
|
| 42 | 3 | } |
|
| 43 | ); |
||
| 44 | |||
| 45 | 3 | if ($directory->count() === 1) { |
|
| 46 | 2 | return $directory->get( |
|
| 47 | 2 | $spreadsheet->sheets()->values()->first()->name().'.csv' |
|
| 48 | ); |
||
| 49 | } |
||
| 50 | |||
| 51 | 1 | return $directory; |
|
| 52 | } |
||
| 53 | |||
| 80 |