MediaWiki REL1_34
RequestData.php
Go to the documentation of this file.
1<?php
2
3namespace MediaWiki\Rest;
4
5use GuzzleHttp\Psr7\Uri;
6use Psr\Http\Message\StreamInterface;
7use Psr\Http\Message\UploadedFileInterface;
8use Psr\Http\Message\UriInterface;
9
14class RequestData extends RequestBase {
15 private $method;
16
18 private $uri;
19
21
23 private $body;
24
26
28
29 private $queryParams;
30
33
34 private $postParams;
35
54 public function __construct( $params = [] ) {
55 $this->method = $params['method'] ?? 'GET';
56 $this->uri = $params['uri'] ?? new Uri;
57 $this->protocolVersion = $params['protocolVersion'] ?? '1.1';
58 $this->body = new StringStream( $params['bodyContents'] ?? '' );
59 $this->serverParams = $params['serverParams'] ?? [];
60 $this->cookieParams = $params['cookieParams'] ?? [];
61 $this->queryParams = $params['queryParams'] ?? [];
62 $this->uploadedFiles = $params['uploadedFiles'] ?? [];
63 $this->postParams = $params['postParams'] ?? [];
64 $this->setPathParams( $params['pathParams'] ?? [] );
65 $this->setHeaders( $params['headers'] ?? [] );
66 parent::__construct( $params['cookiePrefix'] ?? '' );
67 }
68
69 public function getMethod() {
70 return $this->method;
71 }
72
73 public function getUri() {
74 return $this->uri;
75 }
76
77 public function getProtocolVersion() {
79 }
80
81 public function getBody() {
82 return $this->body;
83 }
84
85 public function getServerParams() {
87 }
88
89 public function getCookieParams() {
91 }
92
93 public function getQueryParams() {
94 return $this->queryParams;
95 }
96
97 public function getUploadedFiles() {
99 }
100
101 public function getPostParams() {
102 return $this->postParams;
103 }
104}
Shared code between RequestData and RequestFromGlobals.
setHeaders( $headers)
Erase any existing headers and replace them with the specified header lines.
setPathParams( $params)
Erase all path parameters from the object and set the parameter array to the one specified.
This is a Request class that allows data to be injected, for the purposes of testing or internal requ...
getUri()
Retrieves the URI instance.
getMethod()
Retrieves the HTTP method of the request.
getPostParams()
Retrieve POST form parameters.
UploadedFileInterface[] $uploadedFiles
getServerParams()
Retrieve server parameters.
getProtocolVersion()
Retrieves the HTTP protocol version as a string.
getUploadedFiles()
Retrieve normalized file upload data.
getCookieParams()
Retrieve cookies.
getBody()
Gets the body of the message.
__construct( $params=[])
Construct a RequestData from an array of parameters.
getQueryParams()
Retrieve query string arguments.
A stream class which uses a string as the underlying storage.