Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | |
3 | |
4 | namespace Tal\Psr7Extended; |
5 | |
6 | use Psr\Http\Message\ResponseInterface; |
7 | use Psr\Http\Message\StreamInterface; |
8 | |
9 | interface ServerResponseInterface extends ResponseInterface |
10 | { |
11 | /** |
12 | * Sets the specified status code and, optionally, reason phrase. |
13 | * |
14 | * If no reason phrase is specified, implementations MAY choose to default |
15 | * to the RFC 7231 or IANA recommended reason phrase for the response's |
16 | * status code. |
17 | * |
18 | * @link http://tools.ietf.org/html/rfc7231#section-6 |
19 | * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
20 | * @param int $code The 3-digit integer result code to set. |
21 | * @param string $reasonPhrase The reason phrase to use with the |
22 | * provided status code; if none is provided, implementations MAY |
23 | * use the defaults as suggested in the HTTP specification. |
24 | * @return static |
25 | * @throws \InvalidArgumentException For invalid status code arguments. |
26 | */ |
27 | public function setStatus($code, $reasonPhrase = ''); |
28 | |
29 | /** |
30 | * Sets the specified HTTP protocol version. |
31 | * |
32 | * The version string MUST contain only the HTTP version number (e.g., |
33 | * "1.1", "1.0"). |
34 | * |
35 | * @param string $version HTTP protocol version |
36 | * @return static |
37 | */ |
38 | public function setProtocolVersion($version); |
39 | |
40 | /** |
41 | * Sets the provided value replacing the specified header. |
42 | * |
43 | * While header names are case-insensitive, the casing of the header will |
44 | * be preserved by this function, and returned from getHeaders(). |
45 | * |
46 | * @param string $name Case-insensitive header field name. |
47 | * @param string|string[] $value Header value(s). |
48 | * @return static |
49 | * @throws \InvalidArgumentException for invalid header names or values. |
50 | */ |
51 | public function setHeader($name, $value); |
52 | |
53 | /** |
54 | * Adds the specified header appended with the given value. |
55 | * |
56 | * Existing values for the specified header will be maintained. The new |
57 | * value(s) will be appended to the existing list. If the header did not |
58 | * exist previously, it will be added. |
59 | * |
60 | * @param string $name Case-insensitive header field name to add. |
61 | * @param string|string[] $value Header value(s). |
62 | * @return static |
63 | * @throws \InvalidArgumentException for invalid header names or values. |
64 | */ |
65 | public function addHeader($name, $value); |
66 | |
67 | /** |
68 | * Deletes the specified header. |
69 | * |
70 | * Header resolution MUST be done without case-sensitivity. |
71 | * |
72 | * @param string $name Case-insensitive header field name to remove. |
73 | * @return static |
74 | */ |
75 | public function deleteHeader($name); |
76 | |
77 | /** |
78 | * Sets the specified message body. |
79 | * |
80 | * The body MUST be a StreamInterface object. |
81 | * |
82 | * @param StreamInterface $body Body. |
83 | * @return static |
84 | * @throws \InvalidArgumentException When the body is not valid. |
85 | */ |
86 | public function setBody(StreamInterface $body); |
87 | |
88 | /** |
89 | * Sends this response to the client. |
90 | * |
91 | * @return static |
92 | */ |
93 | public function send(); |
94 | } |