On Fri, Oct 31, 2014 at 1:32 PM, Florian Margaine <flor...@margaine.com>
wrote:

> Hi,
>
> Le 31 oct. 2014 18:28, "Sherif Ramadan" <theanomaly...@gmail.com> a écrit
> :
> >
> > On Fri, Oct 31, 2014 at 1:09 PM, Rowan Collins <rowan.coll...@gmail.com>
> > wrote:
> >
> > >
> > > Let me repeat my question:
> > >
> > > Say I write a class "AwesomeHTTPReceive implements HttpMessageReceive",
> > > what do I then do with this class in order for it to perform any
> actions?
> > >
> > > How does PHP know that my class is the one it should populate, or when
> > > that population should happen?
> > >
> >
> >
> > It wouldn't. You would need to extend the base class, since it already
> > implements the necessary interface. PHP would simply call on the last
> > subtype of HttpRequest during the request init phase.
>
> What if there is multiple subtypes?
>
> class A extends HttpRequest {}
> class B extends HttpRequest {}
>
> What happens there?
>

As of now, all the subtypes would be called, i.e. if A has a receiveMessage
method, it would be handed the message, and if B has a receiveMessage
method it too would be handed the message. It's up to those methods to call
on subsequent parsing methods to do something with the message, obviously
any methods they don't implement are forwarded to the parent.

This clearly has some conflicts, like if default parsing is left we
overwrite superglobal variables. However, it also has benefits, in that we
can have multiple implementations for handling the request in the same code
base and it is left up to the user to decide which one to use.

So, again, this is still a draft and I'm open to suggestions about how to
handle/deal with such problems.




> > Of course, this is an
> > implementation detail as of now. There could certainly be other/better
> ways
> > to accomplish this. I just want to keep it as simple as possible for now
> > without introducing more configuration nightmares that people often
> > complain about. I really don't like the idea of adding yet another INI
> > directive to control this behavior (making it harder to port).
> >
> > What do you propose?
>
> Regards,
> Florian Margaine
>

Reply via email to