MediaWiki REL1_34
|
Shared code between RequestData and RequestFromGlobals. More...
Public Member Functions | |
__clone () | |
getCookie ( $name, $default=null) | |
Add the cookie prefix to a specified cookie name and get the value of the resulting prefixed cookie. | |
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. | |
getPathParam ( $name) | |
Retrieve a single path parameter. | |
getPathParams () | |
Get the parameters derived from the path template match. | |
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. | |
Public Member Functions inherited from MediaWiki\Rest\RequestInterface | |
getBody () | |
Gets the body of the message. | |
getCookieParams () | |
Retrieve cookies. | |
getMethod () | |
Retrieves the HTTP method of the request. | |
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. | |
Protected Member Functions | |
__construct ( $cookiePrefix) | |
initHeaders () | |
Override this in the implementation class if lazy initialisation of header values is desired. | |
setHeaders ( $headers) | |
Erase any existing headers and replace them with the specified header lines. | |
Private Attributes | |
string | $cookiePrefix |
HeaderContainer null | $headerCollection |
array | $pathParams = [] |
Shared code between RequestData and RequestFromGlobals.
Definition at line 8 of file RequestBase.php.
|
protected |
Reimplemented in MediaWiki\Rest\RequestData, and MediaWiki\Rest\RequestFromGlobals.
Definition at line 24 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\$cookiePrefix.
MediaWiki\Rest\RequestBase::__clone | ( | ) |
Definition at line 37 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\$headerCollection.
MediaWiki\Rest\RequestBase::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 |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 102 of file RequestBase.php.
References MediaWiki\Rest\RequestInterface\getCookieParams(), and MediaWiki\Rest\RequestBase\getCookiePrefix().
MediaWiki\Rest\RequestBase::getCookiePrefix | ( | ) |
Get the current cookie prefix.
Implements MediaWiki\Rest\RequestInterface.
Definition at line 98 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\$cookiePrefix.
Referenced by MediaWiki\Rest\RequestBase\getCookie().
MediaWiki\Rest\RequestBase::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. |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 65 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\initHeaders().
MediaWiki\Rest\RequestBase::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. |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 79 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\initHeaders().
MediaWiki\Rest\RequestBase::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().
Implements MediaWiki\Rest\RequestInterface.
Definition at line 58 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\initHeaders().
MediaWiki\Rest\RequestBase::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. |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 94 of file RequestBase.php.
MediaWiki\Rest\RequestBase::getPathParams | ( | ) |
Get the parameters derived from the path template match.
Implements MediaWiki\Rest\RequestInterface.
Definition at line 90 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\$pathParams.
MediaWiki\Rest\RequestBase::hasHeader | ( | $name | ) |
Checks if a header exists by the given case-insensitive name.
string | $name | Case-insensitive header field name. |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 72 of file RequestBase.php.
References MediaWiki\Rest\RequestBase\initHeaders().
|
protected |
Override this in the implementation class if lazy initialisation of header values is desired.
It should call setHeaders().
Reimplemented in MediaWiki\Rest\RequestFromGlobals.
Definition at line 34 of file RequestBase.php.
Referenced by MediaWiki\Rest\RequestBase\getHeader(), MediaWiki\Rest\RequestBase\getHeaderLine(), MediaWiki\Rest\RequestBase\getHeaders(), and MediaWiki\Rest\RequestBase\hasHeader().
|
protected |
Erase any existing headers and replace them with the specified header lines.
Call this either from the constructor or from initHeaders() of the implementing class.
Definition at line 53 of file RequestBase.php.
References MediaWiki\Rest\HeaderContainer\resetHeaders().
Referenced by MediaWiki\Rest\RequestData\__construct(), and MediaWiki\Rest\RequestFromGlobals\initHeaders().
MediaWiki\Rest\RequestBase::setPathParams | ( | $params | ) |
Erase all path parameters from the object and set the parameter array to the one specified.
string[] | $params |
Implements MediaWiki\Rest\RequestInterface.
Definition at line 86 of file RequestBase.php.
Referenced by MediaWiki\Rest\RequestData\__construct().
|
private |
Definition at line 18 of file RequestBase.php.
Referenced by MediaWiki\Rest\RequestBase\__construct(), and MediaWiki\Rest\RequestBase\getCookiePrefix().
|
private |
Definition at line 12 of file RequestBase.php.
Referenced by MediaWiki\Rest\RequestBase\__clone().
|
private |
Definition at line 15 of file RequestBase.php.
Referenced by MediaWiki\Rest\RequestBase\getPathParams().