Conditions | 5 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | public function format(string $message, array $parameters = []): string |
||
14 | { |
||
15 | $replacements = []; |
||
16 | foreach ($parameters as $key => $value) { |
||
17 | if (is_array($value)) { |
||
18 | $value = 'array'; |
||
19 | } elseif (is_object($value)) { |
||
20 | $value = 'object'; |
||
21 | } elseif (is_resource($value)) { |
||
22 | $value = 'resource'; |
||
23 | } |
||
24 | $replacements['{' . $key . '}'] = $value; |
||
25 | } |
||
26 | return strtr($message, $replacements); |
||
27 | } |
||
29 |