Conditions | 5 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
40 | private function interpolate($message, array $context) |
||
41 | { |
||
42 | // build a replacement array with braces around the context keys |
||
43 | $replace = array(); |
||
44 | foreach ($context as $key => $val) { |
||
45 | if (!is_array($val) && (!is_object($val) || method_exists($val, '__toString'))) { |
||
46 | $replace[sprintf('{%s}', $key)] = $val; |
||
47 | } |
||
48 | } |
||
49 | |||
50 | // interpolate replacement values into the message and return |
||
51 | return strtr($message, $replace); |
||
52 | } |
||
53 | } |
||
54 |