Re: RFC: Server-Side Request and Response Objects (v2)
| From: | Paul M. Jones | Date: | Tue, 18 Feb 2020 14:56:39 +0000 |
| Subject: | Re: RFC: Server-Side Request and Response Objects (v2) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108660@lists.php.net to get a copy of this message | ||
> On Feb 18, 2020, at 08:10, Côme Chilliet <come.chilliet@fusiondirectory.org> wrote:
>
> to me that means we also need an addContent method.
I can see why we'd think that; it's symmetrical, if nothing else.
Even so, none of the researched implementations have a method like that. As far as I can recall,
they call have setContent() and getContent() equivalents, but no addContent() equivalent. They all
work much like you point out here ...
> Otherwise people will have to carry a global $content along side $response, or use
> setContent(getContent().$additionalContent).
... although usually it's not a global $content. Instead, the $content is built up from a
template or other subsystem of some sort, and then assigned to the response when complete. For
example:
$content = $template->render();
$response->setContent($content);
So, I am reluctant to add something that no other implementations, across many years and many
authors, have actually found a need for.
Any further thoughts on this?
--
Paul M. Jones
pmjones@pmjones.io
http://paul-m-jones.com
Modernizing Legacy Applications in PHP
https://leanpub.com/mlaphp
Solving the N+1 Problem in PHP
https://leanpub.com/sn1php