Conditions | 5 |
Paths | 8 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function interpolate(string $message, array $context) |
||
42 | { |
||
43 | $replace = $this->analyse($context); |
||
44 | foreach ($this->attribute as $key => $val) { |
||
45 | $replace['%' . $key . '%'] = $val; |
||
46 | } |
||
47 | $message = strtr($message, $replace); |
||
48 | foreach ($this->attach as $name => $value) { |
||
49 | $message.=PHP_EOL.$name.'<' . get_class($val).'>'.PHP_EOL; |
||
|
|||
50 | if ($value instanceof AttachValueInterface) { |
||
51 | $message.= $value->getLogAttach().PHP_EOL; |
||
52 | } elseif ($value instanceof \Exception) { |
||
53 | $message.= DumpTrait::dumpException($value).PHP_EOL; |
||
54 | } else { |
||
55 | $message.= DumpTrait::parameterToString($value).PHP_EOL; |
||
56 | } |
||
57 | } |
||
58 | return $message; |
||
59 | } |
||
61 |