Conditions | 3 |
Paths | 4 |
Total Lines | 20 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
35 | } |
||
36 | |||
37 | $path = addcslashes($path, '#$*+-.?[\]^|'); |
||
38 | |||
39 | $path = str_replace(['(', ')'], ['(?:', ')?'], $path); |
||
40 | |||
41 | foreach ($matches as $match) { |
||
42 | $subpattern = '(?<' . $match['name'] . '>' . ($match['pattern'] ?: '[^/]+') . ')'; |
||
43 | |||
44 | $path = str_replace('{' . $match['name'] . '}', $subpattern, $path); |
||
45 | } |
||
46 | |||
47 | return '#^' . $path . '$#uD'; |
||
48 | } |
||
49 |