Conditions | 4 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | protected function interpolateMessage($message, array $context)//@codingStandardsIgnoreLine Ignore missing type hint |
||
21 | { |
||
22 | $context = array_filter( |
||
23 | $context, |
||
24 | function ($value) { |
||
25 | return (is_scalar($value) || (is_object($value) && method_exists($value, '__toString'))); |
||
26 | } |
||
27 | ); |
||
28 | |||
29 | $search = []; |
||
30 | $replace = []; |
||
31 | foreach ($context as $key => $value) { |
||
32 | $search[] = "{{$key}}"; |
||
33 | $replace[] = (string)$value; |
||
34 | } |
||
35 | |||
36 | return str_replace($search, $replace, $message); |
||
37 | } |
||
39 |