| @@ 911-917 (lines=7) @@ | ||
| 908 | if ($segment === $url[$i]) { |
|
| 909 | $i++; |
|
| 910 | continue; |
|
| 911 | } elseif (preg_match("/{[\w]+}/", $segment)) { |
|
| 912 | // must-have parameters |
|
| 913 | $attribute_name = preg_replace(['/}/', '/{/', "/\?/"], '', $segment); |
|
| 914 | $attributes[$attribute_name] = $url[$i]; |
|
| 915 | $i++; |
|
| 916 | continue; |
|
| 917 | } elseif (preg_match("/{[\w]+\?}/", $segment)) { |
|
| 918 | // optional parameters |
|
| 919 | if (!isset($path[$j + 1]) || $path[$j + 1] !== $url[$i]) { |
|
| 920 | // optional parameter taken |
|
| @@ 934-938 (lines=5) @@ | ||
| 931 | $match = false; |
|
| 932 | break; |
|
| 933 | } |
|
| 934 | } elseif (preg_match("/{[\w]+\?}/", $segment)) { |
|
| 935 | $attribute_name = preg_replace(['/}/', '/{/', "/\?/"], '', $segment); |
|
| 936 | $attributes[$attribute_name] = null; |
|
| 937 | $i++; |
|
| 938 | } else { |
|
| 939 | // no optional parameters but no more $url given |
|
| 940 | // this route does not match the url |
|
| 941 | $match = false; |
|