Chris@0: getQuery()` Chris@0: * or from the `QUERY_STRING` server param. Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function getQueryParams(); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified query string arguments. Chris@0: * Chris@0: * These values SHOULD remain immutable over the course of the incoming Chris@0: * request. They MAY be injected during instantiation, such as from PHP's Chris@0: * $_GET superglobal, or MAY be derived from some other value such as the Chris@0: * URI. In cases where the arguments are parsed from the URI, the data Chris@0: * MUST be compatible with what PHP's parse_str() would return for Chris@0: * purposes of how duplicate query parameters are handled, and how nested Chris@0: * sets are handled. Chris@0: * Chris@0: * Setting query string arguments MUST NOT change the URI stored by the Chris@0: * request, nor the values in the server params. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * updated query string arguments. Chris@0: * Chris@0: * @param array $query Array of query string arguments, typically from Chris@0: * $_GET. Chris@0: * @return static Chris@0: */ Chris@0: public function withQueryParams(array $query); Chris@0: Chris@0: /** Chris@0: * Retrieve normalized file upload data. Chris@0: * Chris@0: * This method returns upload metadata in a normalized tree, with each leaf Chris@0: * an instance of Psr\Http\Message\UploadedFileInterface. Chris@0: * Chris@0: * These values MAY be prepared from $_FILES or the message body during Chris@0: * instantiation, or MAY be injected via withUploadedFiles(). Chris@0: * Chris@0: * @return array An array tree of UploadedFileInterface instances; an empty Chris@0: * array MUST be returned if no data is present. Chris@0: */ Chris@0: public function getUploadedFiles(); Chris@0: Chris@0: /** Chris@0: * Create a new instance with the specified uploaded files. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * updated body parameters. Chris@0: * Chris@0: * @param array $uploadedFiles An array tree of UploadedFileInterface instances. Chris@0: * @return static Chris@0: * @throws \InvalidArgumentException if an invalid structure is provided. Chris@0: */ Chris@0: public function withUploadedFiles(array $uploadedFiles); Chris@0: Chris@0: /** Chris@0: * Retrieve any parameters provided in the request body. Chris@0: * Chris@0: * If the request Content-Type is either application/x-www-form-urlencoded Chris@0: * or multipart/form-data, and the request method is POST, this method MUST Chris@0: * return the contents of $_POST. Chris@0: * Chris@0: * Otherwise, this method may return any results of deserializing Chris@0: * the request body content; as parsing returns structured content, the Chris@0: * potential types MUST be arrays or objects only. A null value indicates Chris@0: * the absence of body content. Chris@0: * Chris@0: * @return null|array|object The deserialized body parameters, if any. Chris@0: * These will typically be an array or object. Chris@0: */ Chris@0: public function getParsedBody(); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified body parameters. Chris@0: * Chris@0: * These MAY be injected during instantiation. Chris@0: * Chris@0: * If the request Content-Type is either application/x-www-form-urlencoded Chris@0: * or multipart/form-data, and the request method is POST, use this method Chris@0: * ONLY to inject the contents of $_POST. Chris@0: * Chris@0: * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of Chris@0: * deserializing the request body content. Deserialization/parsing returns Chris@0: * structured data, and, as such, this method ONLY accepts arrays or objects, Chris@0: * or a null value if nothing was available to parse. Chris@0: * Chris@0: * As an example, if content negotiation determines that the request data Chris@0: * is a JSON payload, this method could be used to create a request Chris@0: * instance with the deserialized parameters. Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * updated body parameters. Chris@0: * Chris@0: * @param null|array|object $data The deserialized body data. This will Chris@0: * typically be in an array or object. Chris@0: * @return static Chris@0: * @throws \InvalidArgumentException if an unsupported argument type is Chris@0: * provided. Chris@0: */ Chris@0: public function withParsedBody($data); Chris@0: Chris@0: /** Chris@0: * Retrieve attributes derived from the request. Chris@0: * Chris@0: * The request "attributes" may be used to allow injection of any Chris@0: * parameters derived from the request: e.g., the results of path Chris@0: * match operations; the results of decrypting cookies; the results of Chris@0: * deserializing non-form-encoded message bodies; etc. Attributes Chris@0: * will be application and request specific, and CAN be mutable. Chris@0: * Chris@0: * @return array Attributes derived from the request. Chris@0: */ Chris@0: public function getAttributes(); Chris@0: Chris@0: /** Chris@0: * Retrieve a single derived request attribute. Chris@0: * Chris@0: * Retrieves a single derived request attribute as described in Chris@0: * getAttributes(). If the attribute has not been previously set, returns Chris@0: * the default value as provided. Chris@0: * Chris@0: * This method obviates the need for a hasAttribute() method, as it allows Chris@0: * specifying a default value to return if the attribute is not found. Chris@0: * Chris@0: * @see getAttributes() Chris@0: * @param string $name The attribute name. Chris@0: * @param mixed $default Default value to return if the attribute does not exist. Chris@0: * @return mixed Chris@0: */ Chris@0: public function getAttribute($name, $default = null); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified derived request attribute. Chris@0: * Chris@0: * This method allows setting a single derived request attribute as Chris@0: * described in getAttributes(). Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that has the Chris@0: * updated attribute. Chris@0: * Chris@0: * @see getAttributes() Chris@0: * @param string $name The attribute name. Chris@0: * @param mixed $value The value of the attribute. Chris@0: * @return static Chris@0: */ Chris@0: public function withAttribute($name, $value); Chris@0: Chris@0: /** Chris@0: * Return an instance that removes the specified derived request attribute. Chris@0: * Chris@0: * This method allows removing a single derived request attribute as Chris@0: * described in getAttributes(). Chris@0: * Chris@0: * This method MUST be implemented in such a way as to retain the Chris@0: * immutability of the message, and MUST return an instance that removes Chris@0: * the attribute. Chris@0: * Chris@0: * @see getAttributes() Chris@0: * @param string $name The attribute name. Chris@0: * @return static Chris@0: */ Chris@0: public function withoutAttribute($name); Chris@0: }