Conditions | 5 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 350 | public function translate( |
|
37 | string $id, |
||
38 | array $parameters = [], |
||
39 | string $category = null, |
||
40 | string $locale = null |
||
41 | ): string { |
||
42 | 350 | $replacements = []; |
|
43 | 350 | foreach ($parameters as $key => $value) { |
|
44 | 350 | if (is_array($value)) { |
|
45 | 32 | $value = 'array'; |
|
46 | 350 | } elseif (is_object($value)) { |
|
47 | 7 | $value = 'object'; |
|
48 | 350 | } elseif (is_resource($value)) { |
|
49 | 1 | $value = 'resource'; |
|
50 | } |
||
51 | 350 | $replacements['{' . $key . '}'] = $value; |
|
52 | } |
||
53 | 350 | return strtr($id, $replacements); |
|
54 | } |
||
66 |