PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 1.23.0
Independent Analytics – WordPress Analytics Plugin v1.23.0
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / psr / http-message / src / ServerRequestInterface.php
independent-analytics / vendor / psr / http-message / src Last commit date
MessageInterface.php 3 years ago RequestInterface.php 3 years ago ResponseInterface.php 3 years ago ServerRequestInterface.php 3 years ago StreamInterface.php 3 years ago UploadedFileInterface.php 3 years ago UriInterface.php 3 years ago
ServerRequestInterface.php
251 lines
1 <?php
2
3 declare (strict_types=1);
4 namespace IAWP_SCOPED\Psr\Http\Message;
5
6 /**
7 * Representation of an incoming, server-side HTTP request.
8 *
9 * Per the HTTP specification, this interface includes properties for
10 * each of the following:
11 *
12 * - Protocol version
13 * - HTTP method
14 * - URI
15 * - Headers
16 * - Message body
17 *
18 * Additionally, it encapsulates all data as it has arrived to the
19 * application from the CGI and/or PHP environment, including:
20 *
21 * - The values represented in $_SERVER.
22 * - Any cookies provided (generally via $_COOKIE)
23 * - Query string arguments (generally via $_GET, or as parsed via parse_str())
24 * - Upload files, if any (as represented by $_FILES)
25 * - Deserialized body parameters (generally from $_POST)
26 *
27 * $_SERVER values MUST be treated as immutable, as they represent application
28 * state at the time of request; as such, no methods are provided to allow
29 * modification of those values. The other values provide such methods, as they
30 * can be restored from $_SERVER or the request body, and may need treatment
31 * during the application (e.g., body parameters may be deserialized based on
32 * content type).
33 *
34 * Additionally, this interface recognizes the utility of introspecting a
35 * request to derive and match additional parameters (e.g., via URI path
36 * matching, decrypting cookie values, deserializing non-form-encoded body
37 * content, matching authorization headers to users, etc). These parameters
38 * are stored in an "attributes" property.
39 *
40 * Requests are considered immutable; all methods that might change state MUST
41 * be implemented such that they retain the internal state of the current
42 * message and return an instance that contains the changed state.
43 */
44 interface ServerRequestInterface extends RequestInterface
45 {
46 /**
47 * Retrieve server parameters.
48 *
49 * Retrieves data related to the incoming request environment,
50 * typically derived from PHP's $_SERVER superglobal. The data IS NOT
51 * REQUIRED to originate from $_SERVER.
52 *
53 * @return array
54 */
55 public function getServerParams();
56 /**
57 * Retrieve cookies.
58 *
59 * Retrieves cookies sent by the client to the server.
60 *
61 * The data MUST be compatible with the structure of the $_COOKIE
62 * superglobal.
63 *
64 * @return array
65 */
66 public function getCookieParams();
67 /**
68 * Return an instance with the specified cookies.
69 *
70 * The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
71 * be compatible with the structure of $_COOKIE. Typically, this data will
72 * be injected at instantiation.
73 *
74 * This method MUST NOT update the related Cookie header of the request
75 * instance, nor related values in the server params.
76 *
77 * This method MUST be implemented in such a way as to retain the
78 * immutability of the message, and MUST return an instance that has the
79 * updated cookie values.
80 *
81 * @param array $cookies Array of key/value pairs representing cookies.
82 * @return static
83 */
84 public function withCookieParams(array $cookies);
85 /**
86 * Retrieve query string arguments.
87 *
88 * Retrieves the deserialized query string arguments, if any.
89 *
90 * Note: the query params might not be in sync with the URI or server
91 * params. If you need to ensure you are only getting the original
92 * values, you may need to parse the query string from `getUri()->getQuery()`
93 * or from the `QUERY_STRING` server param.
94 *
95 * @return array
96 */
97 public function getQueryParams();
98 /**
99 * Return an instance with the specified query string arguments.
100 *
101 * These values SHOULD remain immutable over the course of the incoming
102 * request. They MAY be injected during instantiation, such as from PHP's
103 * $_GET superglobal, or MAY be derived from some other value such as the
104 * URI. In cases where the arguments are parsed from the URI, the data
105 * MUST be compatible with what PHP's parse_str() would return for
106 * purposes of how duplicate query parameters are handled, and how nested
107 * sets are handled.
108 *
109 * Setting query string arguments MUST NOT change the URI stored by the
110 * request, nor the values in the server params.
111 *
112 * This method MUST be implemented in such a way as to retain the
113 * immutability of the message, and MUST return an instance that has the
114 * updated query string arguments.
115 *
116 * @param array $query Array of query string arguments, typically from
117 * $_GET.
118 * @return static
119 */
120 public function withQueryParams(array $query);
121 /**
122 * Retrieve normalized file upload data.
123 *
124 * This method returns upload metadata in a normalized tree, with each leaf
125 * an instance of Psr\Http\Message\UploadedFileInterface.
126 *
127 * These values MAY be prepared from $_FILES or the message body during
128 * instantiation, or MAY be injected via withUploadedFiles().
129 *
130 * @return array An array tree of UploadedFileInterface instances; an empty
131 * array MUST be returned if no data is present.
132 */
133 public function getUploadedFiles();
134 /**
135 * Create a new instance with the specified uploaded files.
136 *
137 * This method MUST be implemented in such a way as to retain the
138 * immutability of the message, and MUST return an instance that has the
139 * updated body parameters.
140 *
141 * @param array $uploadedFiles An array tree of UploadedFileInterface instances.
142 * @return static
143 * @throws \InvalidArgumentException if an invalid structure is provided.
144 */
145 public function withUploadedFiles(array $uploadedFiles);
146 /**
147 * Retrieve any parameters provided in the request body.
148 *
149 * If the request Content-Type is either application/x-www-form-urlencoded
150 * or multipart/form-data, and the request method is POST, this method MUST
151 * return the contents of $_POST.
152 *
153 * Otherwise, this method may return any results of deserializing
154 * the request body content; as parsing returns structured content, the
155 * potential types MUST be arrays or objects only. A null value indicates
156 * the absence of body content.
157 *
158 * @return null|array|object The deserialized body parameters, if any.
159 * These will typically be an array or object.
160 */
161 public function getParsedBody();
162 /**
163 * Return an instance with the specified body parameters.
164 *
165 * These MAY be injected during instantiation.
166 *
167 * If the request Content-Type is either application/x-www-form-urlencoded
168 * or multipart/form-data, and the request method is POST, use this method
169 * ONLY to inject the contents of $_POST.
170 *
171 * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of
172 * deserializing the request body content. Deserialization/parsing returns
173 * structured data, and, as such, this method ONLY accepts arrays or objects,
174 * or a null value if nothing was available to parse.
175 *
176 * As an example, if content negotiation determines that the request data
177 * is a JSON payload, this method could be used to create a request
178 * instance with the deserialized parameters.
179 *
180 * This method MUST be implemented in such a way as to retain the
181 * immutability of the message, and MUST return an instance that has the
182 * updated body parameters.
183 *
184 * @param null|array|object $data The deserialized body data. This will
185 * typically be in an array or object.
186 * @return static
187 * @throws \InvalidArgumentException if an unsupported argument type is
188 * provided.
189 */
190 public function withParsedBody($data);
191 /**
192 * Retrieve attributes derived from the request.
193 *
194 * The request "attributes" may be used to allow injection of any
195 * parameters derived from the request: e.g., the results of path
196 * match operations; the results of decrypting cookies; the results of
197 * deserializing non-form-encoded message bodies; etc. Attributes
198 * will be application and request specific, and CAN be mutable.
199 *
200 * @return array Attributes derived from the request.
201 */
202 public function getAttributes();
203 /**
204 * Retrieve a single derived request attribute.
205 *
206 * Retrieves a single derived request attribute as described in
207 * getAttributes(). If the attribute has not been previously set, returns
208 * the default value as provided.
209 *
210 * This method obviates the need for a hasAttribute() method, as it allows
211 * specifying a default value to return if the attribute is not found.
212 *
213 * @see getAttributes()
214 * @param string $name The attribute name.
215 * @param mixed $default Default value to return if the attribute does not exist.
216 * @return mixed
217 */
218 public function getAttribute(string $name, $default = null);
219 /**
220 * Return an instance with the specified derived request attribute.
221 *
222 * This method allows setting a single derived request attribute as
223 * described in getAttributes().
224 *
225 * This method MUST be implemented in such a way as to retain the
226 * immutability of the message, and MUST return an instance that has the
227 * updated attribute.
228 *
229 * @see getAttributes()
230 * @param string $name The attribute name.
231 * @param mixed $value The value of the attribute.
232 * @return static
233 */
234 public function withAttribute(string $name, $value);
235 /**
236 * Return an instance that removes the specified derived request attribute.
237 *
238 * This method allows removing a single derived request attribute as
239 * described in getAttributes().
240 *
241 * This method MUST be implemented in such a way as to retain the
242 * immutability of the message, and MUST return an instance that removes
243 * the attribute.
244 *
245 * @see getAttributes()
246 * @param string $name The attribute name.
247 * @return static
248 */
249 public function withoutAttribute(string $name);
250 }
251