willdurand / Negotiation

Content Negotiation tools for PHP.
https://williamdurand.fr/Negotiation/
MIT License
1.41k stars 62 forks source link

Dealing with wildcards #45

Closed ericsmal closed 9 years ago

ericsmal commented 9 years ago

Hi William,

Nice job on the content negotiation library. I'm having a few hickups using it, which I can work around. But perhaps my feedback below can be of value.

When submitting getBest('/',array('application/json')) a null value is returned. Submitting getBest('*',array('application/json')) however results in an object containing application/json as value.

Is this expected behaviour? I would think that the first example would return application/json, and that the second isn't a valid wildcard to use.

Also partial wildcards don't seem to work, such as getBest('application/*',array('application/json'))

Any chance of you looking into this, or maybe accepting a PR?

willdurand commented 9 years ago

Is this expected behaviour?

Yes, it is a desired behavior.

I know partial wildcards are not fully supported yet, but I am willing to accept contributions :)