Completed
Branch FET/9575/invisible-recaptcha (4e0b6f)
by
unknown
44:51 queued 31:17
created

EE_Request::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
use EventEspresso\core\exceptions\InvalidDataTypeException;
4
use EventEspresso\core\exceptions\InvalidInterfaceException;
5
use EventEspresso\core\interfaces\InterminableInterface;
6
use EventEspresso\core\services\loaders\LoaderFactory;
7
use EventEspresso\core\services\request\LegacyRequestInterface;
8
use EventEspresso\core\services\request\RequestInterface;
9
10
defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed');
11
12
13
14
/**
15
 * class EE_Request
16
 *
17
 * @deprecated 4.9.53
18
 * @package     Event Espresso
19
 * @subpackage  /core/
20
 * @author      Brent Christensen
21
 */
22
class EE_Request implements LegacyRequestInterface, InterminableInterface
23
{
24
25
    /**
26
     * @var RequestInterface $request
27
     */
28
    private $request;
29
30
    /**
31
     * whether current request is for the admin but NOT via AJAX
32
     *
33
     * @var boolean $admin
34
     */
35
    public $admin = false;
36
37
    /**
38
     * whether current request is via AJAX
39
     *
40
     * @var boolean $ajax
41
     */
42
    public $ajax = false;
43
44
    /**
45
     * whether current request is via AJAX from the frontend of the site
46
     *
47
     * @var boolean $front_ajax
48
     */
49
    public $front_ajax = false;
50
51
52
    /**
53
     * @deprecated 4.9.53
54
     * @param array $get
55
     * @param array $post
56
     * @param array $cookie
57
     * @param array $server
58
     */
59
    public function __construct(array $get, array $post, array $cookie, array $server = array())
60
    {
61
    }
62
63
64
    /**
65
     * @return RequestInterface
66
     * @throws InvalidArgumentException
67
     * @throws InvalidInterfaceException
68
     * @throws InvalidDataTypeException
69
     */
70
    private function request()
71
    {
72
        if($this->request instanceof RequestInterface){
73
            return $this->request;
74
        }
75
        $loader = LoaderFactory::getLoader();
76
        $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface');
77
        return $this->request;
78
    }
79
80
81
    /**
82
     * @param RequestInterface $request
83
     */
84
    public function setRequest(RequestInterface $request)
85
    {
86
        $this->request = $request;
87
    }
88
89
90
91
    /**
92
     * @deprecated 4.9.53
93
     * @return array
94
     * @throws InvalidArgumentException
95
     * @throws InvalidDataTypeException
96
     * @throws InvalidInterfaceException
97
     */
98
    public function get_params()
99
    {
100
        return $this->request()->getParams();
101
    }
102
103
104
105
    /**
106
     * @deprecated 4.9.53
107
     * @return array
108
     * @throws InvalidArgumentException
109
     * @throws InvalidDataTypeException
110
     * @throws InvalidInterfaceException
111
     */
112
    public function post_params()
113
    {
114
        return $this->request()->postParams();
115
    }
116
117
118
119
    /**
120
     * @deprecated 4.9.53
121
     * @return array
122
     * @throws InvalidArgumentException
123
     * @throws InvalidDataTypeException
124
     * @throws InvalidInterfaceException
125
     */
126
    public function cookie_params()
127
    {
128
        return $this->request()->cookieParams();
129
    }
130
131
132
    /**
133
     * @deprecated 4.9.53
134
     * @return array
135
     * @throws InvalidArgumentException
136
     * @throws InvalidDataTypeException
137
     * @throws InvalidInterfaceException
138
     */
139
    public function server_params()
140
    {
141
        return $this->request()->serverParams();
142
    }
143
144
145
146
    /**
147
     * returns contents of $_REQUEST
148
     *
149
     * @deprecated 4.9.53
150
     * @return array
151
     * @throws InvalidArgumentException
152
     * @throws InvalidDataTypeException
153
     * @throws InvalidInterfaceException
154
     */
155
    public function params()
156
    {
157
        return $this->request()->requestParams();
158
    }
159
160
161
162
    /**
163
     * @deprecated 4.9.53
164
     * @param      $key
165
     * @param      $value
166
     * @param bool $override_ee
167
     * @return void
168
     * @throws InvalidArgumentException
169
     * @throws InvalidDataTypeException
170
     * @throws InvalidInterfaceException
171
     */
172
    public function set($key, $value, $override_ee = false)
173
    {
174
        $this->request()->setRequestParam($key, $value, $override_ee);
175
    }
176
177
178
179
    /**
180
     * returns   the value for a request param if the given key exists
181
     *
182
     * @deprecated 4.9.53
183
     * @param      $key
184
     * @param null $default
185
     * @return mixed
186
     * @throws InvalidArgumentException
187
     * @throws InvalidDataTypeException
188
     * @throws InvalidInterfaceException
189
     */
190
    public function get($key, $default = null)
191
    {
192
        return $this->request()->getRequestParam($key, $default);
193
    }
194
195
196
197
    /**
198
     * check if param exists
199
     *
200
     * @deprecated 4.9.53
201
     * @param $key
202
     * @return bool
203
     * @throws InvalidArgumentException
204
     * @throws InvalidDataTypeException
205
     * @throws InvalidInterfaceException
206
     */
207
    public function is_set($key)
208
    {
209
        return $this->request()->requestParamIsSet($key);
210
    }
211
212
213
    /**
214
     * remove param
215
     *
216
     * @deprecated 4.9.53
217
     * @param      $key
218
     * @param bool $unset_from_global_too
219
     * @throws InvalidArgumentException
220
     * @throws InvalidDataTypeException
221
     * @throws InvalidInterfaceException
222
     */
223
    public function un_set($key, $unset_from_global_too = false)
224
    {
225
        $this->request()->unSetRequestParam($key, $unset_from_global_too);
226
    }
227
228
229
230
    /**
231
     * @deprecated 4.9.53
232
     * @return string
233
     * @throws InvalidArgumentException
234
     * @throws InvalidDataTypeException
235
     * @throws InvalidInterfaceException
236
     */
237
    public function ip_address()
238
    {
239
        return $this->request()->ipAddress();
240
    }
241
242
243
    /**
244
     * @deprecated 4.9.53
245
     * @return bool
246
     * @throws InvalidArgumentException
247
     * @throws InvalidDataTypeException
248
     * @throws InvalidInterfaceException
249
     */
250
    public function isAdmin()
251
    {
252
        return $this->request()->isAdmin();
253
    }
254
255
256
    /**
257
     * @deprecated 4.9.53
258
     * @return mixed
259
     * @throws InvalidArgumentException
260
     * @throws InvalidDataTypeException
261
     * @throws InvalidInterfaceException
262
     */
263
    public function isAjax()
264
    {
265
        return $this->request()->isAjax();
266
    }
267
268
269
    /**
270
     * @deprecated 4.9.53
271
     * @return mixed
272
     * @throws InvalidArgumentException
273
     * @throws InvalidDataTypeException
274
     * @throws InvalidInterfaceException
275
     */
276
    public function isFrontAjax()
277
    {
278
        return $this->request()->isFrontAjax();
279
    }
280
281
282
    /**
283
     * @deprecated 4.9.53
284
     * @return mixed|string
285
     * @throws InvalidArgumentException
286
     * @throws InvalidDataTypeException
287
     * @throws InvalidInterfaceException
288
     */
289
    public function requestUri()
290
    {
291
        return $this->request()->requestUri();
292
    }
293
294
295
    /**
296
     * @deprecated 4.9.53
297
     * @return string
298
     * @throws InvalidArgumentException
299
     * @throws InvalidDataTypeException
300
     * @throws InvalidInterfaceException
301
     */
302
    public function userAgent()
303
    {
304
        return $this->request()->userAgent();
305
    }
306
307
308
    /**
309
     * @deprecated 4.9.53
310
     * @param string $user_agent
311
     * @throws InvalidArgumentException
312
     * @throws InvalidDataTypeException
313
     * @throws InvalidInterfaceException
314
     */
315
    public function setUserAgent($user_agent = '')
316
    {
317
        $this->request()->setUserAgent($user_agent);
318
    }
319
320
321
    /**
322
     * @deprecated 4.9.53
323
     * @return bool
324
     * @throws InvalidArgumentException
325
     * @throws InvalidDataTypeException
326
     * @throws InvalidInterfaceException
327
     */
328
    public function isBot()
329
    {
330
        return $this->request()->isBot();
331
    }
332
333
334
    /**
335
     * @deprecated 4.9.53
336
     * @param bool $is_bot
337
     * @throws InvalidArgumentException
338
     * @throws InvalidDataTypeException
339
     * @throws InvalidInterfaceException
340
     */
341
    public function setIsBot($is_bot)
342
    {
343
        $this->request()->setIsBot($is_bot);
344
    }
345
346
347
    /**
348
     * check if a request parameter exists whose key that matches the supplied wildcard pattern
349
     * and return the value for the first match found
350
     * wildcards can be either of the following:
351
     *      ? to represent a single character of any type
352
     *      * to represent one or more characters of any type
353
     *
354
     * @param string     $pattern
355
     * @param null|mixed $default
356
     * @return false|int
357
     * @throws InvalidArgumentException
358
     * @throws InvalidInterfaceException
359
     * @throws InvalidDataTypeException
360
     */
361
    public function getMatch($pattern, $default = null)
362
    {
363
        return $this->request()->getMatch($pattern, $default);
364
    }
365
366
367
    /**
368
     * check if a request parameter exists whose key matches the supplied wildcard pattern
369
     * wildcards can be either of the following:
370
     *      ? to represent a single character of any type
371
     *      * to represent one or more characters of any type
372
     * returns true if a match is found or false if not
373
     *
374
     * @param string $pattern
375
     * @return false|int
376
     * @throws InvalidArgumentException
377
     * @throws InvalidInterfaceException
378
     * @throws InvalidDataTypeException
379
     */
380
    public function matches($pattern)
381
    {
382
        return $this->request()->matches($pattern);
383
    }
384
385
386
}
387
// End of file EE_Request.core.php
388
// Location: /core/request/EE_Request.core.php
389