99 *
1010 * Messages are considered immutable; all methods that might change state MUST
1111 * 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.
1313 *
1414 * @link http://www.ietf.org/rfc/rfc7230.txt
1515 * @link http://www.ietf.org/rfc/rfc7231.txt
@@ -26,13 +26,13 @@ interface MessageInterface
2626 public function getProtocolVersion ();
2727
2828 /**
29- * Create a new instance with the specified HTTP protocol version.
29+ * Return an instance with the specified HTTP protocol version.
3030 *
3131 * The version string MUST contain only the HTTP version number (e.g.,
3232 * "1.1", "1.0").
3333 *
3434 * 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
3636 * new protocol version.
3737 *
3838 * @param string $version HTTP protocol version
@@ -41,7 +41,7 @@ public function getProtocolVersion();
4141 public function withProtocolVersion ($ version );
4242
4343 /**
44- * Retrieves all message headers .
44+ * Retrieves all message header values .
4545 *
4646 * The keys represent the header name as it will be sent over the wire, and
4747 * each value is an array of strings associated with the header.
@@ -62,7 +62,8 @@ public function withProtocolVersion($version);
6262 * exact case in which headers were originally specified.
6363 *
6464 * @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.
6667 */
6768 public function getHeaders ();
6869
@@ -77,44 +78,52 @@ public function getHeaders();
7778 public function hasHeader ($ name );
7879
7980 /**
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.
8182 *
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.
8585 *
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.
9288 *
9389 * @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.
9593 */
9694 public function getHeader ($ name );
9795
9896 /**
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.
103110 *
104111 * @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.
106115 */
107- public function getHeaderLines ($ name );
116+ public function getHeaderLine ($ name );
108117
109118 /**
110- * Create a new instance with the provided header, replacing any existing
119+ * Return an instance with the provided header, replacing any existing
111120 * values of any headers with the same case-insensitive name.
112121 *
113122 * While header names are case-insensitive, the casing of the header will
114123 * be preserved by this function, and returned from getHeaders().
115124 *
116125 * 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
118127 * new and/or updated header and value.
119128 *
120129 * @param string $name Case-insensitive header field name.
@@ -125,15 +134,15 @@ public function getHeaderLines($name);
125134 public function withHeader ($ name , $ value );
126135
127136 /**
128- * Creates a new instance, with the specified header appended with the
137+ * Return an instance with the specified header appended with the
129138 * given value.
130139 *
131140 * Existing values for the specified header will be maintained. The new
132141 * value(s) will be appended to the existing list. If the header did not
133142 * exist previously, it will be added.
134143 *
135144 * 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
137146 * new header and/or value.
138147 *
139148 * @param string $name Case-insensitive header field name to add.
@@ -144,12 +153,12 @@ public function withHeader($name, $value);
144153 public function withAddedHeader ($ name , $ value );
145154
146155 /**
147- * Creates a new instance, without the specified header.
156+ * Return an instance without the specified header.
148157 *
149158 * Header resolution MUST be done without case-sensitivity.
150159 *
151160 * 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
153162 * the named header.
154163 *
155164 * @param string $name Case-insensitive header field name to remove.
@@ -160,22 +169,22 @@ public function withoutHeader($name);
160169 /**
161170 * Gets the body of the message.
162171 *
163- * @return StreamableInterface Returns the body as a stream.
172+ * @return StreamInterface Returns the body as a stream.
164173 */
165174 public function getBody ();
166175
167176 /**
168- * Create a new instance, with the specified message body.
177+ * Return an instance with the specified message body.
169178 *
170- * The body MUST be a StreamableInterface object.
179+ * The body MUST be a StreamInterface object.
171180 *
172181 * This method MUST be implemented in such a way as to retain the
173182 * immutability of the message, and MUST return a new instance that has the
174183 * new body stream.
175184 *
176- * @param StreamableInterface $body Body.
185+ * @param StreamInterface $body Body.
177186 * @return self
178187 * @throws \InvalidArgumentException When the body is not valid.
179188 */
180- public function withBody (StreamableInterface $ body );
189+ public function withBody (StreamInterface $ body );
181190}
0 commit comments