Conditions | 3 |
Paths | 3 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
16 | public static function toString(Translations $translations, array $options = []) |
||
17 | { |
||
18 | $handle = fopen('php://memory', 'w'); |
||
19 | |||
20 | foreach ($translations as $translation) { |
||
21 | $line = [$translation->getContext(), $translation->getOriginal(), $translation->getTranslation()]; |
||
22 | |||
23 | if ($translation->hasPluralTranslations()) { |
||
24 | $line = array_merge($line, $translation->getPluralTranslations()); |
||
25 | } |
||
26 | |||
27 | fputcsv($handle, $line); |
||
28 | } |
||
29 | |||
30 | rewind($handle); |
||
31 | $csv = stream_get_contents($handle); |
||
32 | fclose($handle); |
||
33 | |||
34 | return $csv; |
||
35 | } |
||
36 | } |
||
37 |