MediaWiki master
RequestInterface.php
Go to the documentation of this file.
1<?php
2
31namespace MediaWiki\Rest;
32
33use Psr\Http\Message\StreamInterface;
34use Psr\Http\Message\UriInterface;
35
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
51 public const FORM_DATA_CONTENT_TYPES = [
52 'application/x-www-form-urlencoded',
53 'multipart/form-data',
54 ];
55
61 public function getMethod();
62
72 public function getUri();
73
74 // MessageInterface
75
83 public function getProtocolVersion();
84
114 public function getHeaders();
115
134 public function getHeader( $name );
135
144 public function hasHeader( $name );
145
165 public function getHeaderLine( $name );
166
172 public function getBody();
173
174 // ServerRequestInterface
175
185 public function getServerParams();
186
197 public function getCookieParams();
198
211 public function getQueryParams();
212
222 public function getUploadedFiles();
223
224 // MediaWiki extensions to PSR-7
225
231 public function getPathParams();
232
243 public function getPathParam( $name );
244
251 public function setPathParams( $params );
252
258 public function getCookiePrefix();
259
269 public function getCookie( $name, $default = null );
270
278 public function getPostParams();
279
293 public function getParsedBody(): ?array;
294
305 public function setParsedBody( ?array $data );
306
319 public function getBodyType(): ?string;
320
329 public function hasBody(): bool;
330}
array $params
The job parameters.
A request interface similar to PSR-7's ServerRequestInterface.
getCookiePrefix()
Get the current cookie prefix.
getPathParams()
Get the parameters derived from the path template match.
getUploadedFiles()
Retrieve normalized file upload data.
getQueryParams()
Retrieve query string arguments.
getBodyType()
Returns the MIME type of the request body, according to the content-type header.
getMethod()
Retrieves the HTTP method of the request.
getBody()
Gets the body of the message.
getUri()
Retrieves the URI instance.
getCookie( $name, $default=null)
Add the cookie prefix to a specified cookie name and get the value of the resulting prefixed cookie.
getHeaders()
Retrieves all message header values.
getServerParams()
Retrieve server parameters.
hasBody()
Determines whether the request has body data associated with it.
getHeaderLine( $name)
Retrieves a comma-separated string of the values for a single header.
setPathParams( $params)
Erase all path parameters from the object and set the parameter array to the one specified.
setParsedBody(?array $data)
Specify the data that subsequent calls to getParsedBody() should return.
getPostParams()
Retrieve POST form parameters.
getPathParam( $name)
Retrieve a single path parameter.
getCookieParams()
Retrieve cookies.
getParsedBody()
Returns the parsed body as an associative array.
hasHeader( $name)
Checks if a header exists by the given case-insensitive name.
getHeader( $name)
Retrieves a message header value by the given case-insensitive name.
getProtocolVersion()
Retrieves the HTTP protocol version as a string.