Skip to content

Commit 047c4a9

Browse files
committed
Response divided into storage which doesn't emit data to the browser and ResponseEmitter (BC break!)
1 parent 8657cd6 commit 047c4a9

17 files changed

+407
-261
lines changed

src/Http/IResponse.php

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
/**
1414
* HTTP response interface.
15-
* @method self deleteHeader(string $name)
1615
*/
1716
interface IResponse
1817
{
@@ -141,6 +140,17 @@ interface IResponse
141140
511 => 'Network Authentication Required',
142141
];
143142

143+
/**
144+
* Sets HTTP protocol version.
145+
* @return static
146+
*/
147+
function setProtocolVersion(string $version);
148+
149+
/**
150+
* Returns HTTP protocol version.
151+
*/
152+
function getProtocolVersion(): string;
153+
144154
/**
145155
* Sets HTTP response code.
146156
* @return static
@@ -152,6 +162,11 @@ function setCode(int $code, string $reason = null);
152162
*/
153163
function getCode(): int;
154164

165+
/**
166+
* Returns HTTP reason phrase.
167+
*/
168+
function getReasonPhrase(): string;
169+
155170
/**
156171
* Sends a HTTP header and replaces a previous one.
157172
* @return static
@@ -164,6 +179,11 @@ function setHeader(string $name, string $value);
164179
*/
165180
function addHeader(string $name, string $value);
166181

182+
/**
183+
* @return static
184+
*/
185+
function deleteHeader(string $name);
186+
167187
/**
168188
* Sends a Content-type HTTP header.
169189
* @return static
@@ -181,11 +201,6 @@ function redirect(string $url, int $code = self::S302_FOUND): void;
181201
*/
182202
function setExpiration(?string $expire);
183203

184-
/**
185-
* Checks if headers have been sent.
186-
*/
187-
function isSent(): bool;
188-
189204
/**
190205
* Returns value of an HTTP header.
191206
*/
@@ -208,4 +223,15 @@ function setCookie(string $name, string $value, $expire, string $path = null, st
208223
* Deletes a cookie.
209224
*/
210225
function deleteCookie(string $name, string $path = null, string $domain = null, bool $secure = null);
226+
227+
/**
228+
* @param string|\Closure $body
229+
* @return static
230+
*/
231+
function setBody($body);
232+
233+
/**
234+
* @return string|\Closure
235+
*/
236+
function getBody();
211237
}

0 commit comments

Comments
 (0)