willdurand / Negotiation

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

add AcceptHeader::getMediaType() #47

Closed neural-wetware closed 9 years ago

neural-wetware commented 9 years ago

Necessary to get the actual media type without the parameters appened.

neural-wetware commented 9 years ago

Okay. Another attempt. This is my first time using github so I'm kinda still working things out. The other pull request was crap, I admit. The function didn't even work, let alone execute in php 5.3.

I do think this function is necessary. My application definitely needs it. I'm coding hack workarounds to accommodate the lack of this function.

willdurand commented 9 years ago

Oh ok, now I understand. I don't know if it enough, but I am willing to work on this.

willdurand commented 9 years ago

Question: if it is a media range (application/* for instance), what should this method return?

neural-wetware commented 9 years ago

getBest() returns the media type that the server will return to the client. It has to be an actual media type, not a media type range.

willdurand commented 9 years ago

@neural-wetware I get that, however AcceptHeader might be used somewhere else, hence my question. When adding a feature/method/something, it is always good to think out of the scope of the initial need :)

neural-wetware commented 9 years ago

I guess it should just return application/*.

neural-wetware commented 9 years ago

So can we merge this one?

willdurand commented 9 years ago

I'd like to add more tests first

willdurand commented 9 years ago

also, this needs to be documented :)

neural-wetware commented 9 years ago

How can I add documentation for this?

neural-wetware commented 9 years ago

Hey Will. Just wondering if you're going to merge this? Thanks.

willdurand commented 9 years ago

I will!

willdurand commented 9 years ago

merged! thanks @neural-wetware