| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | public function normalize($object, string $format = null, array $context = []) |
||
| 34 | { |
||
| 35 | /** @var LocalizationableException|Throwable $object */ |
||
| 36 | $data = $this->exceptionNormalizer->normalize($object, $format, $context); |
||
| 37 | $i18n = $object->getI18n(); |
||
|
|
|||
| 38 | $replacements = []; |
||
| 39 | foreach ($i18n->getReplacements() as $key => $value) { |
||
| 40 | if (is_array($value)) { |
||
| 41 | $replacements[$key] = json_encode($value); |
||
| 42 | } else { |
||
| 43 | $replacements[$key] = $value; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | $data['message'] = $this->translator->choice( |
||
| 47 | 'apie::' . $i18n->getMessageString(), |
||
| 48 | $i18n->getAmount(), |
||
| 49 | $replacements |
||
| 50 | ); |
||
| 51 | return $data; |
||
| 52 | } |
||
| 62 |