| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 30 | public function interpolate(string $message, $context = null): string |
|
| 34 | { |
||
| 35 | 30 | if (is_array($context) && count($context) > 0) { |
|
| 36 | 4 | $replace = []; |
|
| 37 | 4 | foreach ($context as $key => $value) { |
|
| 38 | 4 | $replace["{" . $key . "}"] = $value; |
|
| 39 | } |
||
| 40 | |||
| 41 | 4 | return strtr($message, $replace); |
|
| 42 | } |
||
| 43 | |||
| 44 | 26 | return $message; |
|
| 45 | } |
||
| 59 |