| Conditions | 5 |
| Paths | 8 |
| Total Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | 2 | public function make( |
|
| 17 | AllTranslationInterface $allTranslationInterface, |
||
| 18 | ExportTranslationInterface $exportTranslationInterface, |
||
| 19 | $locales |
||
| 20 | ): string { |
||
| 21 | 2 | $translations = $allTranslationInterface->get($locales); |
|
| 22 | |||
| 23 | 2 | $parsedTranslations = []; |
|
| 24 | |||
| 25 | 2 | foreach ($translations as $values) { |
|
| 26 | 2 | foreach ($values as $key => $value) { |
|
| 27 | 2 | if (array_key_exists($key, array_flip($locales))) { |
|
| 28 | 2 | $parsedTranslations[$key][] = [ |
|
| 29 | 2 | 'group' => $values['group'], |
|
| 30 | 2 | 'key' => $values['group'].'.'.$values['key'], |
|
| 31 | 2 | 'value' => $value, |
|
| 32 | ]; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | 2 | foreach ($parsedTranslations as &$translation) { |
|
| 38 | 2 | $translation = collect($translation); |
|
| 39 | } |
||
| 40 | |||
| 41 | 2 | return $exportTranslationInterface->export($parsedTranslations); |
|
| 42 | } |
||
| 43 | } |
||
| 44 |