| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | protected static function replaceUrlParameterBindings(string $uri, array $bindings) |
||
| 27 | { |
||
| 28 | foreach ($bindings as $path => $binding) { |
||
| 29 | // So we can support partial bindings like |
||
| 30 | // 'bindings' => [ |
||
| 31 | // 'foo/{type}' => 4, |
||
| 32 | // 'bar/{type}' => 2 |
||
| 33 | //], |
||
| 34 | if (Str::is("*$path*", $uri)) { |
||
| 35 | preg_match('/({.+?})/', $path, $parameter); |
||
| 36 | $uri = str_replace("{$parameter['1']}", $binding, $uri); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | // Replace any unbound parameters with '1' |
||
| 40 | $uri = preg_replace('/{(.+?)}/', 1, $uri); |
||
| 41 | |||
| 42 | return $uri; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |