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