@@ 861-867 (lines=7) @@ | ||
858 | if ($segment === $url[$i]) { |
|
859 | $i++; |
|
860 | continue; |
|
861 | } elseif (preg_match("/{[\w]+}/", $segment)) { |
|
862 | // must-have parameters |
|
863 | $attribute_name = preg_replace(['/}/', '/{/', "/\?/"], '', $segment); |
|
864 | $attributes[$attribute_name] = $url[$i]; |
|
865 | $i++; |
|
866 | continue; |
|
867 | } elseif (preg_match("/{[\w]+\?}/", $segment)) { |
|
868 | // optional parameters |
|
869 | if (!isset($path[$j + 1]) || $path[$j + 1] !== $url[$i]) { |
|
870 | // optional parameter taken |
|
@@ 884-888 (lines=5) @@ | ||
881 | $match = false; |
|
882 | break; |
|
883 | } |
|
884 | } elseif (preg_match("/{[\w]+\?}/", $segment)) { |
|
885 | $attribute_name = preg_replace(['/}/', '/{/', "/\?/"], '', $segment); |
|
886 | $attributes[$attribute_name] = null; |
|
887 | $i++; |
|
888 | } else { |
|
889 | // no optional parameters but no more $url given |
|
890 | // this route does not match the url |
|
891 | $match = false; |