MediaWiki
master
RequestInterface.php
Go to the documentation of this file.
1
<?php
2
31
namespace
MediaWiki\Rest
;
32
33
use Psr\Http\Message\StreamInterface;
34
use Psr\Http\Message\UriInterface;
35
39
interface
RequestInterface
{
41
public
const
NO_BODY_METHODS = [
'GET'
,
'HEAD'
];
42
44
public
const
BODY_METHODS = [
'POST'
,
'PUT'
];
45
46
// NOTE: per RFC 7231 (https://www.rfc-editor.org/rfc/rfc7231#section-4.3.5), sending a body
47
// with the DELETE method "has no defined semantics". We allow it, as it is useful for
48
// passing the csrf token required by some authentication methods.
49
50
public
const
JSON_CONTENT_TYPE
=
'application/json'
;
51
public
const
MULTIPART_FORM_DATA_CONTENT_TYPE
=
'multipart/form-data'
;
52
public
const
FORM_URLENCODED_CONTENT_TYPE
=
'application/x-www-form-urlencoded'
;
53
55
public
const
FORM_DATA_CONTENT_TYPES = [
56
self::FORM_URLENCODED_CONTENT_TYPE
,
57
self::MULTIPART_FORM_DATA_CONTENT_TYPE
,
58
];
59
65
public
function
getMethod
();
66
76
public
function
getUri
();
77
78
// MessageInterface
79
87
public
function
getProtocolVersion
();
88
118
public
function
getHeaders
();
119
138
public
function
getHeader
( $name );
139
148
public
function
hasHeader
( $name );
149
169
public
function
getHeaderLine
( $name );
170
176
public
function
getBody
();
177
178
// ServerRequestInterface
179
189
public
function
getServerParams
();
190
201
public
function
getCookieParams
();
202
215
public
function
getQueryParams
();
216
226
public
function
getUploadedFiles
();
227
228
// MediaWiki extensions to PSR-7
229
235
public
function
getPathParams
();
236
247
public
function
getPathParam
( $name );
248
255
public
function
setPathParams
( $params );
256
262
public
function
getCookiePrefix
();
263
273
public
function
getCookie
( $name, $default =
null
);
274
282
public
function
getPostParams
();
283
297
public
function
getParsedBody
(): ?array;
298
309
public
function
setParsedBody
( ?array $data );
310
323
public
function
getBodyType
(): ?string;
324
333
public
function
hasBody
(): bool;
334
}
MediaWiki\Rest\RequestInterface
A request interface similar to PSR-7's ServerRequestInterface.
Definition
RequestInterface.php:39
MediaWiki\Rest\RequestInterface\getCookiePrefix
getCookiePrefix()
Get the current cookie prefix.
MediaWiki\Rest\RequestInterface\getPathParams
getPathParams()
Get the parameters derived from the path template match.
MediaWiki\Rest\RequestInterface\getUploadedFiles
getUploadedFiles()
Retrieve normalized file upload data.
MediaWiki\Rest\RequestInterface\getQueryParams
getQueryParams()
Retrieve query string arguments.
MediaWiki\Rest\RequestInterface\getBodyType
getBodyType()
Returns the MIME type of the request body, according to the content-type header.
MediaWiki\Rest\RequestInterface\getMethod
getMethod()
Retrieves the HTTP method of the request.
MediaWiki\Rest\RequestInterface\JSON_CONTENT_TYPE
const JSON_CONTENT_TYPE
Definition
RequestInterface.php:50
MediaWiki\Rest\RequestInterface\getBody
getBody()
Gets the body of the message.
MediaWiki\Rest\RequestInterface\getUri
getUri()
Retrieves the URI instance.
MediaWiki\Rest\RequestInterface\getCookie
getCookie( $name, $default=null)
Add the cookie prefix to a specified cookie name and get the value of the resulting prefixed cookie.
MediaWiki\Rest\RequestInterface\FORM_URLENCODED_CONTENT_TYPE
const FORM_URLENCODED_CONTENT_TYPE
Definition
RequestInterface.php:52
MediaWiki\Rest\RequestInterface\getHeaders
getHeaders()
Retrieves all message header values.
MediaWiki\Rest\RequestInterface\getServerParams
getServerParams()
Retrieve server parameters.
MediaWiki\Rest\RequestInterface\MULTIPART_FORM_DATA_CONTENT_TYPE
const MULTIPART_FORM_DATA_CONTENT_TYPE
Definition
RequestInterface.php:51
MediaWiki\Rest\RequestInterface\hasBody
hasBody()
Determines whether the request has body data associated with it.
MediaWiki\Rest\RequestInterface\getHeaderLine
getHeaderLine( $name)
Retrieves a comma-separated string of the values for a single header.
MediaWiki\Rest\RequestInterface\setPathParams
setPathParams( $params)
Erase all path parameters from the object and set the parameter array to the one specified.
MediaWiki\Rest\RequestInterface\setParsedBody
setParsedBody(?array $data)
Specify the data that subsequent calls to getParsedBody() should return.
MediaWiki\Rest\RequestInterface\getPostParams
getPostParams()
Retrieve POST form parameters.
MediaWiki\Rest\RequestInterface\getPathParam
getPathParam( $name)
Retrieve a single path parameter.
MediaWiki\Rest\RequestInterface\getCookieParams
getCookieParams()
Retrieve cookies.
MediaWiki\Rest\RequestInterface\getParsedBody
getParsedBody()
Returns the parsed body as an associative array.
MediaWiki\Rest\RequestInterface\hasHeader
hasHeader( $name)
Checks if a header exists by the given case-insensitive name.
MediaWiki\Rest\RequestInterface\getHeader
getHeader( $name)
Retrieves a message header value by the given case-insensitive name.
MediaWiki\Rest\RequestInterface\getProtocolVersion
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
MediaWiki\Rest
includes
Rest
RequestInterface.php
Generated on Sat Apr 19 2025 20:26:05 for MediaWiki by
1.10.0