| Conditions | 1 |
| Paths | 1 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | public static function format(string $string, array $variables) |
||
| 17 | { |
||
| 18 | $string = \preg_replace_callback('#\{\}#', function () { |
||
| 19 | static $i = 0; |
||
| 20 | return '{' . ($i++) . '}'; |
||
| 21 | }, $string); |
||
| 22 | |||
| 23 | return \str_replace( |
||
| 24 | \array_map(function ($k) { |
||
| 25 | return '{' . $k . '}'; |
||
| 26 | }, \array_keys($variables)), \array_values($variables), $string |
||
| 27 | ); |
||
| 29 | } |