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