| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | 1 | public function format($locale, $string, array $tokens_values) |
|
| 36 | { |
||
| 37 | 1 | $replace = []; |
|
| 38 | 1 | foreach ($tokens_values as $token => $value) { |
|
| 39 | // convert an array to a CSV string |
||
| 40 | 1 | if (is_array($value)) { |
|
| 41 | 1 | $value = '"' . implode('", "', $value) . '"'; |
|
| 42 | 1 | } |
|
| 43 | 1 | $replace['{' . $token . '}'] = $value; |
|
| 44 | 1 | } |
|
| 45 | 1 | return strtr($string, $replace); |
|
| 46 | } |
||
| 47 | } |
||
| 48 |