| Conditions | 5 |
| Paths | 10 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | private static function buildMessages(Translations $translations) |
||
| 40 | { |
||
| 41 | $pluralForm = $translations->getPluralForms(); |
||
| 42 | $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null; |
||
| 43 | $messages = []; |
||
| 44 | $context_glue = '\u0004'; |
||
| 45 | |||
| 46 | foreach ($translations as $translation) { |
||
| 47 | $key = ($translation->hasContext() ? $translation->getContext().$context_glue : '') |
||
| 48 | .$translation->getOriginal(); |
||
| 49 | |||
| 50 | if ($translation->hasPluralTranslations(true)) { |
||
| 51 | $message = $translation->getPluralTranslations($pluralSize); |
||
| 52 | array_unshift($message, $translation->getTranslation()); |
||
| 53 | } else { |
||
| 54 | $message = [$translation->getTranslation()]; |
||
| 55 | } |
||
| 56 | |||
| 57 | $messages[$key] = $message; |
||
| 58 | } |
||
| 59 | |||
| 60 | return $messages; |
||
| 61 | } |
||
| 62 | } |
||
| 63 |