Re: New classes
| From: | Richard Heyes | Date: | Thu, 07 Feb 2002 13:50:30 +0000 |
| Subject: | Re: New classes | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4469@lists.php.net to get a copy of this message | ||
"Stig S. Bakken" <ssb@alltheweb.com> wrote:
> On Sun, 2002-02-03 at 15:59, Richard Heyes wrote:
> > > I don't think HTTP_POST should be a separate class, but rather a
> > > customization of HTTP_Request. But if you make HTTP_Request you
should
> > > complement it with HTTP_Response. HTTP_Response could store headers
and
> > > maybe have a MIME content interface.
> >
> > How about having a structure like this:
> >
> > HTTP_Client
> > |
> > +-HTTP_Request
> > |
> > +-HTTP_Response
>
> Careful about overdesigning, objects are still expensive in PHP. What
> would HTTP_Client provide that would not make sense to have in
> HTTP_Request?
Thinking about it, it should be like this:
HTTP_Client
|
+-HTTP_Request
|
+-HTTP_Response
Since the response is specific to the request. Wrt advantages, the key thing
I can think of is making multiple request simpler. Eg:
$htclient =& new HTTP_Client();
$page = $htclient->get($url1);
$page = $htclient->get($url2);
I would imagine other uses for the parent Client class would present
themselves
when it comes to response manipulation. Maybe incorporation of the HTTP
class
in PEAR at the moment could also be useful.
--
Richard Heyes