Thinking out-loud: the Accept-* headers could be associated with, but not directly tied to the parsing and dispatching on routes. I'm working on a not-so-fast router for small-scale, and I use pre/post-handlers that essentially decorate the resolved callback. By associating with, you could decorate the callback with the matching accept-header-pre/post handlers, which could inject the appropriate i18n services etc.
If there is no match on the route header "meta-data", a catch-all fires from which you could theoretically abort with a 406, etc.
I dunno. After this conversation I may just hold off on including the http header routing. It's pretty straightforward to take whatever request data structure you're using and handle the negotiation yourself if you want to.
I like the idea of incorporating Accept-* headers into the routing process, but the URI represents the resource, and headers are meta-data about the desired representation.
@rdlowrey Just provide some kind of utility for interpolation of the headers
Utils::$tatic ftw
/hides
The Utils class: The programming equivalent of the cupboard under the stairs where you put stuff that doesn't belong anywhere but you don't want to throw away.
Serious question: what's the advantage of incorporating HTTP header evaluation into the routing process? In other words, what problem is incorporating solving?
@ThW Granted, but if people are wanting to use it then that's what I'd expect. Basically what I'm imagining is $xpath->query(PhpCss::toXpath('el:after'))->item(0)->data = 'foo';
@ThW Yeh I realised that after I wrote it. I think the whole concept of CSS selectors in PHP just breaks my brain because of the number of f*cking terrible implementations there have been
@ThW I used to, then I screwed myself over a few times and now I generally query/foreach for everything. Although granted in that example eval would have been better, the magic "may return node, may return list" is actually pretty useless for fluency because you are liable to call methods that don't exist
Even when I'm only expecting one result, I still get a list and loop over it because you don't lose much and you gain knowledge that everything you expect to be a node really is a node
@ThW I just looked back over some old code (and particularly comments) and am now wanting to punch myself in the face. I have done so much work with DOM and xpath over the last few years and yet I still seem to have missed some fundamental API details
@PeeHaa you win this round, but I will be back. She will love me again.
I already have that, FluentDOM::Query has ArrayAccess, but I am added some lightweigth DOM class extensions to the project, this would have been some nice feature.
I am reading W3 content accessibility page and I am wondering, do you keep documentation on what to tell to a client regarding what the web interface require as a browser?
sometime I work with people saying html5 works great and IE8 in the same sentence
for a very small app I need to store some data (url slug + text) for about 3 hours after it has been submitted. What should I use? SQLite? Flatfiles? something else?
oomg, just gave the dogs baths for the first time. We usually take them to groomers, huge mess all over. Now I gotta give both cats baths... =o\ *puts on body armor*
Cats are notoriously clean animals and notoriously disdainful towards large quantities of water, and I can personally attest that the latter is very much the case.
@crypticツ You want to get one of those dropper things you put on their necks, they really work wonders, all you need to do is go off and do something that would be really inconvenient if you had a cat sitting on you so that the cat will come and sit on you and it's dead easy
My cat gets one of those every 6 mths or so and this is a persistently flea-free household
(at one point she did have fleas and that saw them off within a week)
@ircmaxell You're right. Next time I'll include the binary file and then call an infinitely recursive function. Nothing like a good segfault to terminate execution.
@DaveRandom we got those as well, but trying to wash off as many eggs and flea poop before applying it. I got one cat done. The 8month old, she was easy to do. Once she was wet she sat there and just cried like she was dying. The worst is over as she was the one who has claws.