1010 *
1111 * - Protocol version
1212 * - HTTP method
13- * - URL
13+ * - URI
1414 * - Headers
1515 * - Message body
1616 *
1717 * Additionally, it encapsulates all data as it has arrived to the
18- * application from the PHP environment, including:
18+ * application from the CGI and/or PHP environment, including:
1919 *
2020 * - The values represented in $_SERVER.
2121 * - Any cookies provided (generally via $_COOKIE)
@@ -77,7 +77,7 @@ public function getCookieParams();
7777 * updated cookie values.
7878 *
7979 * @param array $cookies Array of key/value pairs representing cookies.
80- * @return ServerRequestInterface
80+ * @return self
8181 */
8282 public function withCookieParams (array $ cookies );
8383
@@ -102,7 +102,7 @@ public function getQueryParams();
102102 * request. They MAY be injected during instantiation, such as from PHP's
103103 * $_GET superglobal, or MAY be derived from some other value such as the
104104 * URI. In cases where the arguments are parsed from the URI, the data
105- * MUST be compatible with what PHP's ` parse_str()` would return for
105+ * MUST be compatible with what PHP's parse_str() would return for
106106 * purposes of how duplicate query parameters are handled, and how nested
107107 * sets are handled.
108108 *
@@ -115,7 +115,7 @@ public function getQueryParams();
115115 *
116116 * @param array $query Array of query string arguments, typically from
117117 * $_GET.
118- * @return ServerRequestInterface
118+ * @return self
119119 */
120120 public function withQueryParams (array $ query );
121121
@@ -159,7 +159,7 @@ public function getBodyParams();
159159 * updated body parameters.
160160 *
161161 * @param array $params The deserialized body parameters.
162- * @return ServerRequestInterface
162+ * @return self
163163 */
164164 public function withBodyParams (array $ params );
165165
@@ -183,6 +183,9 @@ public function getAttributes();
183183 * getAttributes(). If the attribute has not been previously set, returns
184184 * the default value as provided.
185185 *
186+ * This method obviates the need for a hasAttribute() method, as it allows
187+ * specifying a default value to return if the attribute is not found.
188+ *
186189 * @see getAttributes()
187190 * @param string $attribute Attribute name.
188191 * @param mixed $default Default value to return if the attribute does not exist.
@@ -191,36 +194,37 @@ public function getAttributes();
191194 public function getAttribute ($ attribute , $ default = null );
192195
193196 /**
194- * Create a new instance with the specified attributes as derived from the
195- * request.
197+ * Create a new instance with the specified derived request attribute.
196198 *
197- * This method allows setting request attributes, as described in
198- * getAttributes().
199+ * This method allows setting a single derived request attribute as
200+ * described in getAttributes().
199201 *
200202 * This method MUST be implemented in such a way as to retain the
201203 * immutability of the message, and MUST return a new instance that has the
202- * updated attributes .
204+ * updated attribute .
203205 *
204206 * @see getAttributes()
205- * @param array $attributes Attributes derived from the request.
206- * @return ServerRequestInterface
207+ * @param string $attribute The attribute name.
208+ * @param mixed $value The value of the attribute.
209+ * @return self
207210 */
208- public function withAttributes ( array $ attributes );
211+ public function withAttribute ( $ attribute , $ value );
209212
210213 /**
211- * Create a new instance with the specified derived request attribute.
214+ * Create a new instance that removes the specified derived request
215+ * attribute.
212216 *
213- * This method allows setting a single derived request attribute as
217+ * This method allows removing a single derived request attribute as
214218 * described in getAttributes().
215219 *
216220 * This method MUST be implemented in such a way as to retain the
217- * immutability of the message, and MUST return a new instance that has the
218- * updated attribute.
221+ * immutability of the message, and MUST return a new instance that removes
222+ * the attribute.
219223 *
220224 * @see getAttributes()
221225 * @param string $attribute The attribute name.
222226 * @param mixed $value The value of the attribute.
223- * @return ServerRequestInterface
227+ * @return self
224228 */
225- public function withAttribute ($ attribute , $ value );
229+ public function withoutAttribute ($ attribute , $ value );
226230}
0 commit comments