@@ -136,32 +136,46 @@ public function getFileParams();
136
136
/**
137
137
* Retrieve any parameters provided in the request body.
138
138
*
139
- * If the request body can be deserialized to an array, this method MAY be
140
- * used to retrieve them .
139
+ * If the request Content-Type is application/x-www-form-urlencoded and the
140
+ * request method is POST, this method MUST return the contents of $_POST .
141
141
*
142
- * @return array The deserialized body parameters, if any.
142
+ * Otherwise, this method may return any results of deserializing
143
+ * the request body content; as parsing returns structured content, the
144
+ * potential types MUST be arrays or objects only. A null value indicates
145
+ * the absence of body content.
146
+ *
147
+ * @return null|array|object The deserialized body parameters, if any.
148
+ * These will typically be an array or object.
143
149
*/
144
- public function getBodyParams ();
150
+ public function getParsedBody ();
145
151
146
152
/**
147
153
* Create a new instance with the specified body parameters.
148
154
*
149
- * These MAY be injected during instantiation from PHP's $_POST
150
- * superglobal. The data IS NOT REQUIRED to come from $_POST, but MUST be
151
- * an array. This method can be used during the request lifetime to inject
152
- * parameters discovered and/or deserialized from the request body; as an
153
- * example, if content negotiation determines that the request data is
154
- * a JSON payload, this method could be used to inject the deserialized
155
- * parameters.
155
+ * These MAY be injected during instantiation.
156
+ *
157
+ * If the request Content-Type is application/x-www-form-urlencoded and the
158
+ * request method is POST, use this method ONLY to inject the contents of
159
+ * $_POST.
160
+ *
161
+ * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
162
+ * deserializing the request body content. Deserialization/parsing returns
163
+ * structured data, and, as such, this method ONLY accepts arrays or objects,
164
+ * or a null value if nothing was available to parse.
165
+ *
166
+ * As an example, if content negotiation determines that the request data
167
+ * is a JSON payload, this method could be used to create a request
168
+ * instance with the deserialized parameters.
156
169
*
157
170
* This method MUST be implemented in such a way as to retain the
158
171
* immutability of the message, and MUST return a new instance that has the
159
172
* updated body parameters.
160
173
*
161
- * @param array $params The deserialized body parameters.
174
+ * @param null|array|object $data The deserialized body data. This will
175
+ * typically be in an array or object.
162
176
* @return self
163
177
*/
164
- public function withBodyParams ( array $ params );
178
+ public function withParsedBody ( $ data );
165
179
166
180
/**
167
181
* Retrieve attributes derived from the request.
0 commit comments