Conditions | 5 |
Paths | 5 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5.5069 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
38 | 66 | private function format(string $message, array $params = []): string |
|
39 | { |
||
40 | 66 | $replacements = []; |
|
41 | 66 | foreach ($params as $key => $value) { |
|
42 | 36 | if (is_array($value)) { |
|
43 | $value = 'array'; |
||
44 | 36 | } elseif (is_object($value)) { |
|
45 | $value = 'object'; |
||
46 | 36 | } elseif (is_resource($value)) { |
|
47 | $value = 'resource'; |
||
48 | } |
||
49 | 36 | $replacements['{' . $key . '}'] = $value; |
|
50 | } |
||
51 | 66 | return strtr($message, $replacements); |
|
52 | } |
||
54 |