Passed
Push — master ( ad5059...a1cd5c )
by Roeland
12:23 queued 11s
created
lib/public/IRequest.php 1 patch
Indentation   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -69,253 +69,253 @@
 block discarded – undo
69 69
  * @since 6.0.0
70 70
  */
71 71
 interface IRequest {
72
-	/**
73
-	 * @since 9.1.0
74
-	 */
75
-	public const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/';
76
-
77
-	/**
78
-	 * @since 13.0.0
79
-	 */
80
-	public const USER_AGENT_TALK_ANDROID = '/^Mozilla\/5\.0 \(Android\) Nextcloud\-Talk v.*$/';
81
-
82
-	/**
83
-	 * @since 9.1.0
84
-	 */
85
-	public const USER_AGENT_CLIENT_DESKTOP = '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/';
86
-
87
-	/**
88
-	 * @since 9.1.0
89
-	 */
90
-	public const USER_AGENT_CLIENT_IOS = '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/';
91
-
92
-	/**
93
-	 * @since 13.0.0
94
-	 */
95
-	public const USER_AGENT_TALK_IOS = '/^Mozilla\/5\.0 \(iOS\) Nextcloud\-Talk v.*$/';
96
-
97
-	/**
98
-	 * @since 13.0.1
99
-	 */
100
-	public const USER_AGENT_OUTLOOK_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Outlook v.*$/';
101
-
102
-	/**
103
-	 * @since 13.0.1
104
-	 */
105
-	public const USER_AGENT_THUNDERBIRD_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Thunderbird v.*$/';
106
-
107
-	/**
108
-	 * @param string $name
109
-	 *
110
-	 * @psalm-taint-source input
111
-	 *
112
-	 * @return string
113
-	 * @since 6.0.0
114
-	 */
115
-	public function getHeader(string $name): string;
116
-
117
-	/**
118
-	 * Lets you access post and get parameters by the index
119
-	 * In case of json requests the encoded json body is accessed
120
-	 *
121
-	 * @psalm-taint-source input
122
-	 *
123
-	 * @param string $key the key which you want to access in the URL Parameter
124
-	 *                     placeholder, $_POST or $_GET array.
125
-	 *                     The priority how they're returned is the following:
126
-	 *                     1. URL parameters
127
-	 *                     2. POST parameters
128
-	 *                     3. GET parameters
129
-	 * @param mixed $default If the key is not found, this value will be returned
130
-	 * @return mixed the content of the array
131
-	 * @since 6.0.0
132
-	 */
133
-	public function getParam(string $key, $default = null);
134
-
135
-
136
-	/**
137
-	 * Returns all params that were received, be it from the request
138
-	 *
139
-	 * (as GET or POST) or through the URL by the route
140
-	 *
141
-	 * @psalm-taint-source input
142
-	 *
143
-	 * @return array the array with all parameters
144
-	 * @since 6.0.0
145
-	 */
146
-	public function getParams(): array;
147
-
148
-	/**
149
-	 * Returns the method of the request
150
-	 *
151
-	 * @return string the method of the request (POST, GET, etc)
152
-	 * @since 6.0.0
153
-	 */
154
-	public function getMethod(): string;
155
-
156
-	/**
157
-	 * Shortcut for accessing an uploaded file through the $_FILES array
158
-	 *
159
-	 * @param string $key the key that will be taken from the $_FILES array
160
-	 * @return array the file in the $_FILES element
161
-	 * @since 6.0.0
162
-	 */
163
-	public function getUploadedFile(string $key);
164
-
165
-
166
-	/**
167
-	 * Shortcut for getting env variables
168
-	 *
169
-	 * @param string $key the key that will be taken from the $_ENV array
170
-	 * @return array the value in the $_ENV element
171
-	 * @since 6.0.0
172
-	 */
173
-	public function getEnv(string $key);
174
-
175
-
176
-	/**
177
-	 * Shortcut for getting cookie variables
178
-	 *
179
-	 * @psalm-taint-source input
180
-	 *
181
-	 * @param string $key the key that will be taken from the $_COOKIE array
182
-	 * @return string|null the value in the $_COOKIE element
183
-	 * @since 6.0.0
184
-	 */
185
-	public function getCookie(string $key);
186
-
187
-
188
-	/**
189
-	 * Checks if the CSRF check was correct
190
-	 *
191
-	 * @return bool true if CSRF check passed
192
-	 * @since 6.0.0
193
-	 */
194
-	public function passesCSRFCheck(): bool;
195
-
196
-	/**
197
-	 * Checks if the strict cookie has been sent with the request if the request
198
-	 * is including any cookies.
199
-	 *
200
-	 * @return bool
201
-	 * @since 9.0.0
202
-	 */
203
-	public function passesStrictCookieCheck(): bool;
204
-
205
-	/**
206
-	 * Checks if the lax cookie has been sent with the request if the request
207
-	 * is including any cookies.
208
-	 *
209
-	 * @return bool
210
-	 * @since 9.0.0
211
-	 */
212
-	public function passesLaxCookieCheck(): bool;
213
-
214
-	/**
215
-	 * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging
216
-	 * If `mod_unique_id` is installed this value will be taken.
217
-	 *
218
-	 * @return string
219
-	 * @since 8.1.0
220
-	 */
221
-	public function getId(): string;
222
-
223
-	/**
224
-	 * Returns the remote address, if the connection came from a trusted proxy
225
-	 * and `forwarded_for_headers` has been configured then the IP address
226
-	 * specified in this header will be returned instead.
227
-	 * Do always use this instead of $_SERVER['REMOTE_ADDR']
228
-	 *
229
-	 * @return string IP address
230
-	 * @since 8.1.0
231
-	 */
232
-	public function getRemoteAddress(): string;
233
-
234
-	/**
235
-	 * Returns the server protocol. It respects reverse proxy servers and load
236
-	 * balancers.
237
-	 *
238
-	 * @return string Server protocol (http or https)
239
-	 * @since 8.1.0
240
-	 */
241
-	public function getServerProtocol(): string;
242
-
243
-	/**
244
-	 * Returns the used HTTP protocol.
245
-	 *
246
-	 * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
247
-	 * @since 8.2.0
248
-	 */
249
-	public function getHttpProtocol(): string;
250
-
251
-	/**
252
-	 * Returns the request uri, even if the website uses one or more
253
-	 * reverse proxies
254
-	 *
255
-	 * @psalm-taint-source input
256
-	 *
257
-	 * @return string
258
-	 * @since 8.1.0
259
-	 */
260
-	public function getRequestUri(): string;
261
-
262
-	/**
263
-	 * Get raw PathInfo from request (not urldecoded)
264
-	 *
265
-	 * @psalm-taint-source input
266
-	 *
267
-	 * @throws \Exception
268
-	 * @return string Path info
269
-	 * @since 8.1.0
270
-	 */
271
-	public function getRawPathInfo(): string;
272
-
273
-	/**
274
-	 * Get PathInfo from request
275
-	 *
276
-	 * @psalm-taint-source input
277
-	 *
278
-	 * @throws \Exception
279
-	 * @return string|false Path info or false when not found
280
-	 * @since 8.1.0
281
-	 */
282
-	public function getPathInfo();
283
-
284
-	/**
285
-	 * Returns the script name, even if the website uses one or more
286
-	 * reverse proxies
287
-	 *
288
-	 * @return string the script name
289
-	 * @since 8.1.0
290
-	 */
291
-	public function getScriptName(): string;
292
-
293
-	/**
294
-	 * Checks whether the user agent matches a given regex
295
-	 *
296
-	 * @param array $agent array of agent names
297
-	 * @return bool true if at least one of the given agent matches, false otherwise
298
-	 * @since 8.1.0
299
-	 */
300
-	public function isUserAgent(array $agent): bool;
301
-
302
-	/**
303
-	 * Returns the unverified server host from the headers without checking
304
-	 * whether it is a trusted domain
305
-	 *
306
-	 * @psalm-taint-source input
307
-	 *
308
-	 * @return string Server host
309
-	 * @since 8.1.0
310
-	 */
311
-	public function getInsecureServerHost(): string;
312
-
313
-	/**
314
-	 * Returns the server host from the headers, or the first configured
315
-	 * trusted domain if the host isn't in the trusted list
316
-	 *
317
-	 * @return string Server host
318
-	 * @since 8.1.0
319
-	 */
320
-	public function getServerHost(): string;
72
+    /**
73
+     * @since 9.1.0
74
+     */
75
+    public const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/';
76
+
77
+    /**
78
+     * @since 13.0.0
79
+     */
80
+    public const USER_AGENT_TALK_ANDROID = '/^Mozilla\/5\.0 \(Android\) Nextcloud\-Talk v.*$/';
81
+
82
+    /**
83
+     * @since 9.1.0
84
+     */
85
+    public const USER_AGENT_CLIENT_DESKTOP = '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/';
86
+
87
+    /**
88
+     * @since 9.1.0
89
+     */
90
+    public const USER_AGENT_CLIENT_IOS = '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/';
91
+
92
+    /**
93
+     * @since 13.0.0
94
+     */
95
+    public const USER_AGENT_TALK_IOS = '/^Mozilla\/5\.0 \(iOS\) Nextcloud\-Talk v.*$/';
96
+
97
+    /**
98
+     * @since 13.0.1
99
+     */
100
+    public const USER_AGENT_OUTLOOK_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Outlook v.*$/';
101
+
102
+    /**
103
+     * @since 13.0.1
104
+     */
105
+    public const USER_AGENT_THUNDERBIRD_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Thunderbird v.*$/';
106
+
107
+    /**
108
+     * @param string $name
109
+     *
110
+     * @psalm-taint-source input
111
+     *
112
+     * @return string
113
+     * @since 6.0.0
114
+     */
115
+    public function getHeader(string $name): string;
116
+
117
+    /**
118
+     * Lets you access post and get parameters by the index
119
+     * In case of json requests the encoded json body is accessed
120
+     *
121
+     * @psalm-taint-source input
122
+     *
123
+     * @param string $key the key which you want to access in the URL Parameter
124
+     *                     placeholder, $_POST or $_GET array.
125
+     *                     The priority how they're returned is the following:
126
+     *                     1. URL parameters
127
+     *                     2. POST parameters
128
+     *                     3. GET parameters
129
+     * @param mixed $default If the key is not found, this value will be returned
130
+     * @return mixed the content of the array
131
+     * @since 6.0.0
132
+     */
133
+    public function getParam(string $key, $default = null);
134
+
135
+
136
+    /**
137
+     * Returns all params that were received, be it from the request
138
+     *
139
+     * (as GET or POST) or through the URL by the route
140
+     *
141
+     * @psalm-taint-source input
142
+     *
143
+     * @return array the array with all parameters
144
+     * @since 6.0.0
145
+     */
146
+    public function getParams(): array;
147
+
148
+    /**
149
+     * Returns the method of the request
150
+     *
151
+     * @return string the method of the request (POST, GET, etc)
152
+     * @since 6.0.0
153
+     */
154
+    public function getMethod(): string;
155
+
156
+    /**
157
+     * Shortcut for accessing an uploaded file through the $_FILES array
158
+     *
159
+     * @param string $key the key that will be taken from the $_FILES array
160
+     * @return array the file in the $_FILES element
161
+     * @since 6.0.0
162
+     */
163
+    public function getUploadedFile(string $key);
164
+
165
+
166
+    /**
167
+     * Shortcut for getting env variables
168
+     *
169
+     * @param string $key the key that will be taken from the $_ENV array
170
+     * @return array the value in the $_ENV element
171
+     * @since 6.0.0
172
+     */
173
+    public function getEnv(string $key);
174
+
175
+
176
+    /**
177
+     * Shortcut for getting cookie variables
178
+     *
179
+     * @psalm-taint-source input
180
+     *
181
+     * @param string $key the key that will be taken from the $_COOKIE array
182
+     * @return string|null the value in the $_COOKIE element
183
+     * @since 6.0.0
184
+     */
185
+    public function getCookie(string $key);
186
+
187
+
188
+    /**
189
+     * Checks if the CSRF check was correct
190
+     *
191
+     * @return bool true if CSRF check passed
192
+     * @since 6.0.0
193
+     */
194
+    public function passesCSRFCheck(): bool;
195
+
196
+    /**
197
+     * Checks if the strict cookie has been sent with the request if the request
198
+     * is including any cookies.
199
+     *
200
+     * @return bool
201
+     * @since 9.0.0
202
+     */
203
+    public function passesStrictCookieCheck(): bool;
204
+
205
+    /**
206
+     * Checks if the lax cookie has been sent with the request if the request
207
+     * is including any cookies.
208
+     *
209
+     * @return bool
210
+     * @since 9.0.0
211
+     */
212
+    public function passesLaxCookieCheck(): bool;
213
+
214
+    /**
215
+     * Returns an ID for the request, value is not guaranteed to be unique and is mostly meant for logging
216
+     * If `mod_unique_id` is installed this value will be taken.
217
+     *
218
+     * @return string
219
+     * @since 8.1.0
220
+     */
221
+    public function getId(): string;
222
+
223
+    /**
224
+     * Returns the remote address, if the connection came from a trusted proxy
225
+     * and `forwarded_for_headers` has been configured then the IP address
226
+     * specified in this header will be returned instead.
227
+     * Do always use this instead of $_SERVER['REMOTE_ADDR']
228
+     *
229
+     * @return string IP address
230
+     * @since 8.1.0
231
+     */
232
+    public function getRemoteAddress(): string;
233
+
234
+    /**
235
+     * Returns the server protocol. It respects reverse proxy servers and load
236
+     * balancers.
237
+     *
238
+     * @return string Server protocol (http or https)
239
+     * @since 8.1.0
240
+     */
241
+    public function getServerProtocol(): string;
242
+
243
+    /**
244
+     * Returns the used HTTP protocol.
245
+     *
246
+     * @return string HTTP protocol. HTTP/2, HTTP/1.1 or HTTP/1.0.
247
+     * @since 8.2.0
248
+     */
249
+    public function getHttpProtocol(): string;
250
+
251
+    /**
252
+     * Returns the request uri, even if the website uses one or more
253
+     * reverse proxies
254
+     *
255
+     * @psalm-taint-source input
256
+     *
257
+     * @return string
258
+     * @since 8.1.0
259
+     */
260
+    public function getRequestUri(): string;
261
+
262
+    /**
263
+     * Get raw PathInfo from request (not urldecoded)
264
+     *
265
+     * @psalm-taint-source input
266
+     *
267
+     * @throws \Exception
268
+     * @return string Path info
269
+     * @since 8.1.0
270
+     */
271
+    public function getRawPathInfo(): string;
272
+
273
+    /**
274
+     * Get PathInfo from request
275
+     *
276
+     * @psalm-taint-source input
277
+     *
278
+     * @throws \Exception
279
+     * @return string|false Path info or false when not found
280
+     * @since 8.1.0
281
+     */
282
+    public function getPathInfo();
283
+
284
+    /**
285
+     * Returns the script name, even if the website uses one or more
286
+     * reverse proxies
287
+     *
288
+     * @return string the script name
289
+     * @since 8.1.0
290
+     */
291
+    public function getScriptName(): string;
292
+
293
+    /**
294
+     * Checks whether the user agent matches a given regex
295
+     *
296
+     * @param array $agent array of agent names
297
+     * @return bool true if at least one of the given agent matches, false otherwise
298
+     * @since 8.1.0
299
+     */
300
+    public function isUserAgent(array $agent): bool;
301
+
302
+    /**
303
+     * Returns the unverified server host from the headers without checking
304
+     * whether it is a trusted domain
305
+     *
306
+     * @psalm-taint-source input
307
+     *
308
+     * @return string Server host
309
+     * @since 8.1.0
310
+     */
311
+    public function getInsecureServerHost(): string;
312
+
313
+    /**
314
+     * Returns the server host from the headers, or the first configured
315
+     * trusted domain if the host isn't in the trusted list
316
+     *
317
+     * @return string Server host
318
+     * @since 8.1.0
319
+     */
320
+    public function getServerHost(): string;
321 321
 }
Please login to merge, or discard this patch.