| Conditions | 5 |
| Paths | 12 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function interpolate(string $message, array $context, array $attribute) |
||
| 36 | { |
||
| 37 | list($attach, $replace) = $this->analyse($context); |
||
| 38 | $attribute = array_merge($this->attribute, $attribute); |
||
| 39 | foreach ($attribute as $key => $val) { |
||
| 40 | $replace['%' . $key . '%'] = $val; |
||
| 41 | } |
||
| 42 | $message = strtr($message, $replace); |
||
| 43 | $attachInfo = ''; |
||
| 44 | foreach ($attach as $name => $value) { |
||
| 45 | $attachInfo = $name.' = '; |
||
| 46 | if ($value instanceof AttachValueInterface) { |
||
| 47 | $attachInfo.= $value->getLogAttach().PHP_EOL; |
||
| 48 | } else { |
||
| 49 | $attachInfo.= DumpTrait::parameterToString($value).PHP_EOL; |
||
| 50 | } |
||
| 51 | } |
||
| 52 | if (strlen($attachInfo) > 0) { |
||
| 53 | return $message.PHP_EOL.$attachInfo; |
||
| 54 | } |
||
| 55 | return $message; |
||
| 56 | } |
||
| 68 |