Conditions | 1 |
Paths | 1 |
Total Lines | 7 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | public function replace(string $pattern, array $tokens): string |
||
12 | { |
||
13 | return preg_replace_callback(self::REGEXP, function ($matches) use ($tokens) { |
||
14 | $argument = $matches[1]; |
||
15 | $replace = $tokens[$argument] ?? '[^}]+'; |
||
16 | return '(?P<' . $argument . '>' . $replace . ')'; |
||
17 | }, $pattern); |
||
18 | } |
||
19 | } |