9
9
*
10
10
* Messages are considered immutable; all methods that might change state MUST
11
11
* be implemented such that they retain the internal state of the current
12
- * message and return a new instance that contains the changed state.
12
+ * message and return an instance that contains the changed state.
13
13
*
14
14
* @link http://www.ietf.org/rfc/rfc7230.txt
15
15
* @link http://www.ietf.org/rfc/rfc7231.txt
@@ -26,13 +26,13 @@ interface MessageInterface
26
26
public function getProtocolVersion ();
27
27
28
28
/**
29
- * Create a new instance with the specified HTTP protocol version.
29
+ * Return an instance with the specified HTTP protocol version.
30
30
*
31
31
* The version string MUST contain only the HTTP version number (e.g.,
32
32
* "1.1", "1.0").
33
33
*
34
34
* This method MUST be implemented in such a way as to retain the
35
- * immutability of the message, and MUST return a new instance that has the
35
+ * immutability of the message, and MUST return an instance that has the
36
36
* new protocol version.
37
37
*
38
38
* @param string $version HTTP protocol version
@@ -41,7 +41,7 @@ public function getProtocolVersion();
41
41
public function withProtocolVersion ($ version );
42
42
43
43
/**
44
- * Retrieves all message headers .
44
+ * Retrieves all message header values .
45
45
*
46
46
* The keys represent the header name as it will be sent over the wire, and
47
47
* each value is an array of strings associated with the header.
@@ -62,7 +62,8 @@ public function withProtocolVersion($version);
62
62
* exact case in which headers were originally specified.
63
63
*
64
64
* @return array Returns an associative array of the message's headers. Each
65
- * key MUST be a header name, and each value MUST be an array of strings.
65
+ * key MUST be a header name, and each value MUST be an array of strings
66
+ * for that header.
66
67
*/
67
68
public function getHeaders ();
68
69
@@ -77,44 +78,52 @@ public function getHeaders();
77
78
public function hasHeader ($ name );
78
79
79
80
/**
80
- * Retrieve a header by the given case-insensitive name, as a string .
81
+ * Retrieves a message header value by the given case-insensitive name.
81
82
*
82
- * This method returns all of the header values of the given
83
- * case-insensitive header name as a string concatenated together using
84
- * a comma.
83
+ * This method returns an array of all the header values of the given
84
+ * case-insensitive header name.
85
85
*
86
- * NOTE: Not all header values may be appropriately represented using
87
- * comma concatenation. For such headers, use getHeaderLines() instead
88
- * and supply your own delimiter when concatenating.
89
- *
90
- * If the header did not appear in the message, this method should return
91
- * a null value.
86
+ * If the header does not appear in the message, this method MUST return an
87
+ * empty array.
92
88
*
93
89
* @param string $name Case-insensitive header field name.
94
- * @return string|null
90
+ * @return string[] An array of string values as provided for the given
91
+ * header. If the header does not appear in the message, this method MUST
92
+ * return an empty array.
95
93
*/
96
94
public function getHeader ($ name );
97
95
98
96
/**
99
- * Retrieves a header by the given case-insensitive name as an array of strings.
100
- *
101
- * If the header did not appear in the message, this method should return an
102
- * empty array.
97
+ * Retrieves the line for a single header, with the header values as a
98
+ * comma-separated string.
99
+ *
100
+ * This method returns all of the header values of the given
101
+ * case-insensitive header name as a string concatenated together using
102
+ * a comma.
103
+ *
104
+ * NOTE: Not all header values may be appropriately represented using
105
+ * comma concatenation. For such headers, use getHeader() instead
106
+ * and supply your own delimiter when concatenating.
107
+ *
108
+ * If the header does not appear in the message, this method MUST return
109
+ * a null value.
103
110
*
104
111
* @param string $name Case-insensitive header field name.
105
- * @return string[]
112
+ * @return string|null A string of values as provided for the given header
113
+ * concatenated together using a comma. If the header does not appear in
114
+ * the message, this method MUST return a null value.
106
115
*/
107
- public function getHeaderLines ($ name );
116
+ public function getHeaderLine ($ name );
108
117
109
118
/**
110
- * Create a new instance with the provided header, replacing any existing
119
+ * Return an instance with the provided header, replacing any existing
111
120
* values of any headers with the same case-insensitive name.
112
121
*
113
122
* While header names are case-insensitive, the casing of the header will
114
123
* be preserved by this function, and returned from getHeaders().
115
124
*
116
125
* This method MUST be implemented in such a way as to retain the
117
- * immutability of the message, and MUST return a new instance that has the
126
+ * immutability of the message, and MUST return an instance that has the
118
127
* new and/or updated header and value.
119
128
*
120
129
* @param string $name Case-insensitive header field name.
@@ -125,15 +134,15 @@ public function getHeaderLines($name);
125
134
public function withHeader ($ name , $ value );
126
135
127
136
/**
128
- * Creates a new instance, with the specified header appended with the
137
+ * Return an instance with the specified header appended with the
129
138
* given value.
130
139
*
131
140
* Existing values for the specified header will be maintained. The new
132
141
* value(s) will be appended to the existing list. If the header did not
133
142
* exist previously, it will be added.
134
143
*
135
144
* This method MUST be implemented in such a way as to retain the
136
- * immutability of the message, and MUST return a new instance that has the
145
+ * immutability of the message, and MUST return an instance that has the
137
146
* new header and/or value.
138
147
*
139
148
* @param string $name Case-insensitive header field name to add.
@@ -144,12 +153,12 @@ public function withHeader($name, $value);
144
153
public function withAddedHeader ($ name , $ value );
145
154
146
155
/**
147
- * Creates a new instance, without the specified header.
156
+ * Return an instance without the specified header.
148
157
*
149
158
* Header resolution MUST be done without case-sensitivity.
150
159
*
151
160
* This method MUST be implemented in such a way as to retain the
152
- * immutability of the message, and MUST return a new instance that removes
161
+ * immutability of the message, and MUST return an instance that removes
153
162
* the named header.
154
163
*
155
164
* @param string $name Case-insensitive header field name to remove.
@@ -160,22 +169,22 @@ public function withoutHeader($name);
160
169
/**
161
170
* Gets the body of the message.
162
171
*
163
- * @return StreamableInterface Returns the body as a stream.
172
+ * @return StreamInterface Returns the body as a stream.
164
173
*/
165
174
public function getBody ();
166
175
167
176
/**
168
- * Create a new instance, with the specified message body.
177
+ * Return an instance with the specified message body.
169
178
*
170
- * The body MUST be a StreamableInterface object.
179
+ * The body MUST be a StreamInterface object.
171
180
*
172
181
* This method MUST be implemented in such a way as to retain the
173
182
* immutability of the message, and MUST return a new instance that has the
174
183
* new body stream.
175
184
*
176
- * @param StreamableInterface $body Body.
185
+ * @param StreamInterface $body Body.
177
186
* @return self
178
187
* @throws \InvalidArgumentException When the body is not valid.
179
188
*/
180
- public function withBody (StreamableInterface $ body );
189
+ public function withBody (StreamInterface $ body );
181
190
}
0 commit comments