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