MediaWiki REL1_34
|
A request interface similar to PSR-7's ServerRequestInterface. More...
Public Member Functions | |
getBody () | |
Gets the body of the message. | |
getCookie ( $name, $default=null) | |
Add the cookie prefix to a specified cookie name and get the value of the resulting prefixed cookie. | |
getCookieParams () | |
Retrieve cookies. | |
getCookiePrefix () | |
Get the current cookie prefix. | |
getHeader ( $name) | |
Retrieves a message header value by the given case-insensitive name. | |
getHeaderLine ( $name) | |
Retrieves a comma-separated string of the values for a single header. | |
getHeaders () | |
Retrieves all message header values. | |
getMethod () | |
Retrieves the HTTP method of the request. | |
getPathParam ( $name) | |
Retrieve a single path parameter. | |
getPathParams () | |
Get the parameters derived from the path template match. | |
getPostParams () | |
Retrieve POST form parameters. | |
getProtocolVersion () | |
Retrieves the HTTP protocol version as a string. | |
getQueryParams () | |
Retrieve query string arguments. | |
getServerParams () | |
Retrieve server parameters. | |
getUploadedFiles () | |
Retrieve normalized file upload data. | |
getUri () | |
Retrieves the URI instance. | |
hasHeader ( $name) | |
Checks if a header exists by the given case-insensitive name. | |
setPathParams ( $params) | |
Erase all path parameters from the object and set the parameter array to the one specified. | |
A request interface similar to PSR-7's ServerRequestInterface.
Definition at line 39 of file RequestInterface.php.
MediaWiki\Rest\RequestInterface::getBody | ( | ) |
Gets the body of the message.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
Referenced by MediaWiki\Rest\Validator\Validator\validateBody().
MediaWiki\Rest\RequestInterface::getCookie | ( | $name, | |
$default = null ) |
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.
string | $name | |
mixed | null | $default |
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::getCookieParams | ( | ) |
Retrieve cookies.
Retrieves cookies sent by the client to the server.
The data MUST be compatible with the structure of the $_COOKIE superglobal.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
Referenced by MediaWiki\Rest\RequestBase\getCookie().
MediaWiki\Rest\RequestInterface::getCookiePrefix | ( | ) |
MediaWiki\Rest\RequestInterface::getHeader | ( | $name | ) |
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().
string | $name | Case-insensitive header field name. |
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::getHeaderLine | ( | $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.
string | $name | Case-insensitive header field name. |
Implemented in MediaWiki\Rest\RequestBase.
Referenced by MediaWiki\Rest\Validator\Validator\validateBody().
MediaWiki\Rest\RequestInterface::getHeaders | ( | ) |
Retrieves all message header values.
The keys represent the header name as it will be sent over the wire, and each value is an array of strings associated with the header.
// Represent the headers as a string foreach ($message->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().
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::getMethod | ( | ) |
Retrieves the HTTP method of the request.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
Referenced by MediaWiki\Rest\Router\execute(), and MediaWiki\Rest\Validator\Validator\validateBody().
MediaWiki\Rest\RequestInterface::getPathParam | ( | $name | ) |
Retrieve a single path parameter.
Retrieves a single path parameter as described in getPathParams(). If the attribute has not been previously set, returns null.
string | $name | The parameter name. |
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::getPathParams | ( | ) |
Get the parameters derived from the path template match.
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::getPostParams | ( | ) |
Retrieve POST form parameters.
This will return an array of parameters in the format of $_POST.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
MediaWiki\Rest\RequestInterface::getProtocolVersion | ( | ) |
Retrieves the HTTP protocol version as a string.
The string MUST contain only the HTTP version number (e.g., "1.1", "1.0").
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
MediaWiki\Rest\RequestInterface::getQueryParams | ( | ) |
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.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
MediaWiki\Rest\RequestInterface::getServerParams | ( | ) |
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.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
MediaWiki\Rest\RequestInterface::getUploadedFiles | ( | ) |
Retrieve normalized file upload data.
This method returns upload metadata in a normalized tree, with each leaf an instance of Psr\Http\Message\UploadedFileInterface.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
MediaWiki\Rest\RequestInterface::getUri | ( | ) |
Retrieves the URI instance.
This method MUST return a UriInterface instance.
UriInterface Returns a UriInterface instance representing the URI of the request.
Implemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
Referenced by MediaWiki\Rest\Router\execute().
MediaWiki\Rest\RequestInterface::hasHeader | ( | $name | ) |
Checks if a header exists by the given case-insensitive name.
string | $name | Case-insensitive header field name. |
Implemented in MediaWiki\Rest\RequestBase.
MediaWiki\Rest\RequestInterface::setPathParams | ( | $params | ) |
Erase all path parameters from the object and set the parameter array to the one specified.
string[] | $params |
Implemented in MediaWiki\Rest\RequestBase.
Referenced by MediaWiki\Rest\Router\execute().