How to tell if a URL didn't match vs. had no modifiers?
lord2800 opened this issue · comments
I'm looking to integrate this into my routing library instead of the bad regex-based hack of a URL parser I have right now, but I can't seem to find how I tell if a uri template didn't match a given url. Is that not something this does right now?
I've added a new strict
mode param to extract
method in 0.2.5
which allows you to do a full matching against uri. (i.e. return null
when it's partially matched or $params
when it's fully matched.
So, you can use this to check if it matches your uri or not. An example is in README file.
I'll check it out tonight. Thanks!
Hmm, either I'm misunderstanding how this should be used or my tests are wrong: https://travis-ci.org/lord2800/convey/builds/27191193#L621
I have fixed some bugs that related to matching problem in 0.2.6
. Apart from that I saw that you check the result with
if(is_array($args) && !empty($args)) {
It should use either isset
instead. Because when it tries to extract template that doesn't have variables it'll return an empty array
$args = $extract('/', '/', true); # return empty array `[]`
if (isset($args)) {
...
}
Hope it helps
That got me down to one test failing, which I think is my fault now. Hooray! Thanks.