getHeaders() as $name => $values) { * echo $name . ": " . implode(", ", $values); * } * * // Emit headers iteratively: * foreach ($message->getHeaders() as $name => $values) { * foreach ($values as $value) { * header(sprintf('%s: %s', $name, $value), false); * } * } * * While header names are not case-sensitive, getHeaders() will preserve the * exact case in which headers were originally specified. * * A single header value may be a string containing a comma-separated list. * Lists will not necessarily be split into arrays. See the comment on * HeaderContainer::convertToListAndString(). * * @return string[][] Returns an associative array of the message's headers. Each * key MUST be a header name, and each value MUST be an array of strings * for that header. */ function getHeaders(); /** * Retrieves a message header value by the given case-insensitive name. * * This method returns an array of all the header values of the given * case-insensitive header name. * * If the header does not appear in the message, this method MUST return an * empty array. * * A single header value may be a string containing a comma-separated list. * Lists will not necessarily be split into arrays. See the comment on * HeaderContainer::convertToListAndString(). * * @param string $name Case-insensitive header field name. * @return string[] An array of string values as provided for the given * header. If the header does not appear in the message, this method MUST * return an empty array. */ function getHeader( $name ); /** * Checks if a header exists by the given case-insensitive name. * * @param string $name Case-insensitive header field name. * @return bool Returns true if any header names match the given header * name using a case-insensitive string comparison. Returns false if * no matching header name is found in the message. */ function hasHeader( $name ); /** * Retrieves a comma-separated string of the values for a single header. * * This method returns all of the header values of the given * case-insensitive header name as a string concatenated together using * a comma. * * NOTE: Not all header values may be appropriately represented using * comma concatenation. For such headers, use getHeader() instead * and supply your own delimiter when concatenating. * * If the header does not appear in the message, this method MUST return * an empty string. * * @param string $name Case-insensitive header field name. * @return string A string of values as provided for the given header * concatenated together using a comma. If the header does not appear in * the message, this method MUST return an empty string. */ function getHeaderLine( $name ); /** * Gets the body of the message. * * @return StreamInterface Returns the body as a stream. */ function getBody(); // ServerRequestInterface /** * Retrieve server parameters. * * Retrieves data related to the incoming request environment, * typically derived from PHP's $_SERVER superglobal. The data IS NOT * REQUIRED to originate from $_SERVER. * * @return array */ function getServerParams(); /** * Retrieve cookies. * * Retrieves cookies sent by the client to the server. * * The data MUST be compatible with the structure of the $_COOKIE * superglobal. * * @return array */ function getCookieParams(); /** * Retrieve query string arguments. * * Retrieves the deserialized query string arguments, if any. * * Note: the query params might not be in sync with the URI or server * params. If you need to ensure you are only getting the original * values, you may need to parse the query string from `getUri()->getQuery()` * or from the `QUERY_STRING` server param. * * @return array */ function getQueryParams(); /** * Retrieve normalized file upload data. * * This method returns upload metadata in a normalized tree, with each leaf * an instance of Psr\Http\Message\UploadedFileInterface. * * @return array An array tree of UploadedFileInterface instances; an empty * array MUST be returned if no data is present. */ function getUploadedFiles(); /** * Retrieve attributes derived from the request. * * The request "attributes" may be used to allow injection of any * parameters derived from the request: e.g., the results of path * match operations; the results of decrypting cookies; the results of * deserializing non-form-encoded message bodies; etc. Attributes * will be application and request specific, and CAN be mutable. * * @return array Attributes derived from the request. */ function getAttributes(); /** * Retrieve a single derived request attribute. * * Retrieves a single derived request attribute as described in * getAttributes(). If the attribute has not been previously set, returns * the default value as provided. * * This method obviates the need for a hasAttribute() method, as it allows * specifying a default value to return if the attribute is not found. * * @see getAttributes() * @param string $name The attribute name. * @param mixed|null $default Default value to return if the attribute does not exist. * @return mixed */ function getAttribute( $name, $default = null ); // MediaWiki extensions to PSR-7 /** * Erase all attributes from the object and set the attribute array to the * specified value * * @param mixed[] $attributes */ function setAttributes( $attributes ); /** * Get the current cookie prefix * * @return string */ function getCookiePrefix(); /** * Add the cookie prefix to a specified cookie name and get the value of * the resulting prefixed cookie. If the cookie does not exist, $default * is returned. * * @param string $name * @param mixed|null $default * @return mixed The cookie value as a string, or $default */ function getCookie( $name, $default = null ); /** * Retrieve POST form parameters. * * This will return an array of parameters in the format of $_POST. * * @return array The deserialized POST parameters */ function getPostParams(); }