| Conditions | 3 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 5 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 15 | public static function fromString($string, Translations $translations, array $options = []) |
||
| 16 | { |
||
| 17 | $handle = fopen('php://memory', 'w'); |
||
| 18 | |||
| 19 | fputs($handle, $string); |
||
| 20 | rewind($handle); |
||
| 21 | |||
| 22 | $entries = []; |
||
| 23 | |||
| 24 | while ($row = fgetcsv($handle)) { |
||
| 25 | $entries[$row[0]] = $row[1]; |
||
| 26 | } |
||
| 27 | |||
| 28 | fclose($handle); |
||
| 29 | |||
| 30 | foreach ($entries as $original => $translation) { |
||
| 31 | $translations->insert(null, $original)->setTranslation($translation); |
||
| 32 | } |
||
| 33 | |||
| 34 | return $translations; |
||
| 35 | } |
||
| 36 | } |
||
| 37 |