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